rails3 中的远程 form_tag 没有命名路由 [英] remote form_tag in rails3 without a named route

查看:29
本文介绍了rails3 中的远程 form_tag 没有命名路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使这个实际异步发布的正确咒语是什么?

what is the proper incantation to make this actually post asynchronously?

form_tag :controller => :magic, :action => :search, :method => post, :remote => true do

method=post 和 remote=true 只是在 url 的末尾被压扁,而不是实际使它成为一个 ajax 帖子.

method=post and remote=true just get squashed on the end of the url instead of actually making it an ajax post.

推荐答案

我发现的唯一方法是将 url 参数包装在 url_for 方法中.

The only way I found to do it is to wrap the url parameters in the url_for method.

form_tag url_for(:action => :create, :id => @artist.id), :remote => true do 

但是,如果您需要传递 method 参数,您可能需要将它和遥控器包装在括号中.

However, if you need to the pass the method parameter you might need to wrap that and the remote in parentheses.

这篇关于rails3 中的远程 form_tag 没有命名路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆