Davide Spaggiari wrote:

>> What's the url that is supposed to be invoking the arg action?
> 
> http://localhost:3000/questions/arg
> 
>> if you want arg as an action for the whole collection, then I'd expect 
>> to see something like
>> 
>> map.resources :questions, :collection => {:arg => :get}
> 
> That way it works. But can you explain me the reason ?
> What's the meaning of the parameter :collection => {:arg => :get} ?
> 
> Every time i create a new action, I have to update the routes.rb file ??

That is true, yes. The RESTful design methodology requires you to define 
custom actions in your routes file. That is because earlier when we used 
map.connect ':controller/:action/:id' we always used the GET method - 
for the destroy, create and update actions.

Then someone found out that you could make the urls prettier (and 
respect the RESTful design philosophy) by using other standard HTTP 
methods like DELETE, POST and PUT. Therefore you have to actually tell 
Rails what method you'ld like to use, it will not use GET by default. 
That is actually good. Imagine having half of your custom actions being 
using the GET method, the other half using the POST, PUT or DELETE 
method. Then you'ld need to define what method to use for half of them 
in your routes file (instead of all of them). What a mess... (:
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to