Ruby on Rails Sunday, May 1, 2011

I'm unable to figure out how to submit specific data to a Rails update()
method via the jQuery submit() method. This is the code snippet I'm
working with:


<% form_for(vote, :remote => true) do |f| %>
<%= check_box_tag "selection", vote.id %>
<% end %>

...

<%= link_to 'Vote Yes', ballots_path, :onclick =>
"$('.edit_vote').submit()" %>
<%= link_to 'Vote No', ballots_path, :onclick =>
"$('.edit_vote').submit()" %>


How do I use the jQuery submit method to submit specific data to the
Vote controller update method? (for example if I press "Vote Yes" then
it submits ":approval => true" so that I can use params[:approval] to
update the particular vote)

Am I even on the right track?

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment