Ruby on Rails Tuesday, July 28, 2015

On 28 July 2015 at 21:48, Taras Matsyk <lists@ruby-forum.com> wrote:
> Hi everyone,
>
> A short description of the issue. I have a one page app which displays a
> list of items people can vote for. The tricky part is that some users
> can add more than 1 vote because of their status. Each item is displayed
> through @item.each loop with its picture, amount of votes and button
> "Vote".
>
> <% @items.each do |item| %>
> <div class="itemContainer">
> <h4 style="text-align:center"> <%= product.name %> </h4>
> <%= image_tag(item.photo_url) %>
> <%= label_tag("price: #{item.votes_left}") %>
> <%= label_tag("left: #{item.votes}") %>
> <%= number_field_tag 'quantity', nil, min: 1, max: 10 %>
> <button class="btn btn-default"> Vote </button>
> </div>
> <% end %>
>
> What I am interested in is in finding a way to send "number_field_tag
> 'quantity'" value in request by clicking "Vote" button.

You can use a form. That is what forms are for.

Colin

--
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/CAL%3D0gLsyvEfywkxj9W8cRWMF%3DBiGKg64%3DbvAWoq8jpVmFtG6_w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment