Yeah, it should have been a #find_by_id instead of #find. With regards
to params[:artist_id], it's not from an actual querystring parameter
but rather from a nested route:

/artists/1/paintings

Which IMHO is more RESTful.

Cheers,

On Oct 11, 11:58 pm, Bill Walton <[email protected]> wrote:
> Hi Erol,
>
> On Mon, Oct 11, 2010 at 10:45 AM, Erol Fornoles <[email protected]> 
> wrote:
>
> Your routing suggestion is good, however this
>
> > �...@artist = Artist.find(params[:artist_id])
>
> will throw an exception if params[:artist_id] is not supplied.  You
> could avoid that using Artist.find_by_id which should return nil
> rather than throwing a RecordNotFound exception.  At the same time, it
> is not typical for an index method to be called with parameters.  More
> typical to simply supply a list method for that purpose and include it
> in your routes.
>
> Best regards,
> Bill

-- 
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