derm_w wrote:
> So I would like to have a 'No record found' displayed when non
> existant ID is inserted just like find_by_id does when it returns nil.
This would be something like:
def show
@album = Album.find_by_id(params[:id])
unless @album then
# Here you could render a template or redirect to a different action
render :template => 'record_not_found'
end
# When the album is found, the default template for this method is
rendered
end
--
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
-~----------~----~----~----~------~----~------~--~---