link_to_remote does not generate correct url in Haml

Posted by mathee on Stack Overflow See other posts from Stack Overflow or by mathee
Published on 2010-05-27T07:29:50Z Indexed on 2010/05/27 7:31 UTC
Read the original article Hit count: 215

Filed under:
|

In Haml, I've been trying to get the following link_to_remote call to work. It's called from the /questions/new view.

#{link_to_remote image_tag('x.png'), :url => {:controller => 'questions', :action => 'remove_tag_from_cart'}}

I've tried the following variations.

#{link_to_remote image_tag('x.png'), :url => {:controller => :questions, :action => :remove_tag_from_cart}}
#{link_to_remote image_tag('x.png'), :controller => 'questions', :action => 'remove_tag_from_cart'}
#{link_to_remote image_tag('x.png'), :controller => :questions, :action => :remove_tag_from_cart}

In every case, I get the following link: /questions/new#. I'm not sure why!

I also have the following in routes.rb, thinking that was the problem...

map.connect ':controller/remove_tag_from_cart', :action => 'remove_tag_from_cart'

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about routes