How should i write a nice restful route for an ajax-call that adds a
tag to a particular game. I have games, they can have (multiple) tags,
and you can edit those in the admin_area, for which i have written
these resources:
map.namespace(:admin) do |admin|
admin.resources :games
admin.resources :tags, :member => {:add_to_game => :post}
end
which gives me admin_games_path etc. By the way, is that (the admin/
tags-controller) a good place for a method to add a tag to a game?
Should it be elsewhere (in the admin/game-controller for example)?
My problem is how i should write this in a drop_receiving_element tag,
especially how i can pass a put-method with it, since that seems more
logical in a restful-context. I had this in my routes (instead of
above)
map.namespace(:admin) do |admin|
admin.resources :games
admin.resources :tags, :member => {:add_to_game => :put}
end
but i didn’t know how to write that into my droppable-tag:
drop_receiving_element div_id, :url =>
add_to_game_admin_tag_path(someid), :hoverclass => ‘hover’
that one only seems to generate (ajax) post-requests, and i didn’t
succeed in passing a :method => :put with the url correcly.
How should i write that?