Skip to content

Instantly share code, notes, and snippets.

@trak3r
Created January 6, 2009 22:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trak3r/44060 to your computer and use it in GitHub Desktop.
Save trak3r/44060 to your computer and use it in GitHub Desktop.
= link_to_remote(image_tag(video.thumbnail_url, :alt => h(video.title)), :update => 'main', :url => { :action => 'wtf', :id => video.id })
# produces "/videos/wtf/77"
= link_to_remote(image_tag(video.thumbnail_url, :alt => h(video.title)), :update => 'main', :url => { :action => 'show', :id => video.id })
# produces "/videos/77"
# notice how it *removed* the 'show' action from the url!?
# when i do a "get" of "/videos/77" from the browser it works:
Processing VideosController#show (for 127.0.0.1 at 2009-01-06 17:42:34) [GET]
Parameters: {"action"=>"show", "id"=>"77", "controller"=>"videos"}
# *but* the link_to_remote creates a "post" which doesn't work because the id is converted (by the routes!?) as the *action* !! wtf!?
Processing VideosController#77 (for 127.0.0.1 at 2009-01-06 17:43:12) [POST]
Parameters: {"action"=>"77", "authenticity_token"=>"901ead6c236111998504c51cd483630fe7a1f9f8", "controller"=>"videos"}
# what's in my routes.rb:
map.resources :videos, :member => {:rate => :post}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment