Ruby on Rails Saturday, November 11, 2017

ok, nevermind.  I figured it out , I removed the " ".

On Saturday, November 11, 2017 at 1:59:59 PM UTC-5, Joe Guerra wrote:
I have just added qty to a product page.

I think I need to somehow put the button_to into the form, but it's working ok now.  

I'd like to pass in an instant variable @remaining into the max form element instead of using a fixed value there now (5).

I think I tried max = "<% @remaining %>", but that didn't work.  Not sure how that is passed into a form element.

<form>
Quantity:
<input type="number" name="quantity" value="1" min="1" max= "5" ><br>

</form>
<%= button_to "Add to Cart", { :controller => "products", :action => "add_to_cart", product_id: @product } %>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/70c67ad4-5830-4f62-ae19-327003879145%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment