Rails 3 form_tag 带远程不发送提交详细信息
当使用正常的非远程请求时,此表单 100% 有效。但是当我设置远程=>时true 它不再发送提交值。我应该完全不同地做这件事,还是我遗漏了什么?
<%= form_tag [voteable, Vote.new], :remote => true do |f| %>
<strong class="votes_balance"><%= voteable.votes_for - voteable.votes_against %></strong>
<%= submit_tag :up, { :name => "thumb_direction", :class => "vote_up" } %>
<%= submit_tag :down, { :name => "thumb_direction", :class => "vote_down" } %>
<%= hidden_field_tag :voteable_type, voteable.class %>
<% end %>
参数
authenticity_token /8Dkx/EQc+VqgZd8f/eoWevm8AIgOwK0rzXqlGUzDUA=
utf8 ✓
voteable_type Article
应该发送
authenticity_token /8Dkx/EQc+VqgZd8f/eoWevm8AIgOwK0rzXqlGUzDUA=
utf8 ✓
voteable_type Article
thumb_direction up
This form works 100% when using the normal non-remote request. However when I set remote => true it is not longer sending the submit value. Should I do this completely differently, or is there something I'm missing?
<%= form_tag [voteable, Vote.new], :remote => true do |f| %>
<strong class="votes_balance"><%= voteable.votes_for - voteable.votes_against %></strong>
<%= submit_tag :up, { :name => "thumb_direction", :class => "vote_up" } %>
<%= submit_tag :down, { :name => "thumb_direction", :class => "vote_down" } %>
<%= hidden_field_tag :voteable_type, voteable.class %>
<% end %>
params
authenticity_token /8Dkx/EQc+VqgZd8f/eoWevm8AIgOwK0rzXqlGUzDUA=
utf8 ✓
voteable_type Article
should send
authenticity_token /8Dkx/EQc+VqgZd8f/eoWevm8AIgOwK0rzXqlGUzDUA=
utf8 ✓
voteable_type Article
thumb_direction up
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可能有一种更简洁的方法,我也简单地尝试了button_to方法,但不知道如何将其全部压缩。
There is probably a more concise way, I also tried briefly the button_to method but couldn't figure out how to squeeze it all in.