Hi David,
The last route is correct, but what is the chuck method doing ?
maybe you're looking for :collection => {:chuck => :get}
Hi David,
The last route is correct, but what is the chuck method doing ?
maybe you're looking for :collection => {:chuck => :get}
Its not really that weird is it ?
In the second case its passing beetlejuice as the id, your controller doesn't know its an invalid id until you try and find the record - @account = Account.find(params[:id])
I think you have 2 choices here:
1) You can keep everything RESTful and add chuck in like this:
map.resources :accounts, :collection => {:chuck => :get}
which will give you the route /accounts;chuck
2) you can include a custom route before your map.resources like this:
map.connect 'accounts/chuck', :controller => 'accounts', :action => 'chuck'
which give you the route /accounts/chuck
Your choice...#2 is not the restful way AFAIK
Hi Dave,
Just trying to see what's possible with map.resources. I got the new agile 1.2 book - but it really doesn't explain the difference between a collection and a member very well.
In a Rails way, it would be Collection has_many :members,
Member belongs_to :collection
-- Jean-François.
In this context a member would mean an individual instance of the model Account.
A collection would be interested in more than one member of the model Account.
So the index route/action/view is a collection because it is accessing a collection of accounts (possibly all accounts)
The show route/action/view however is a member because it is only interested in one member of the model Account. (hence :id being part of the route - this is how the individual member is identified)
I hope this is helpful and not more confusing
disclaimer: I am quite new to ruby/rails/REST so please don't take my word as gospel.