Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remote form_tag in rails3 without a named route

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

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

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

like image 973
Dennis Collective Avatar asked Aug 17 '10 22:08

Dennis Collective


1 Answers

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 

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

like image 196
Sean Avatar answered Oct 10 '22 04:10

Sean