On Mar 29, 1:59 pm, derm_w <[email protected]> wrote:
> Hi all.
>
> I'm new to rails and am learning my way by putting together a simple
> app.
>
> I'm pulling items out of the params by using find(params['id']) and
> showing results in a show view.
>
> Things are going along nicely until I enter an ID into the address bar
> that does not exist. Then the whole thing blows up and I get  ACTIVE
> RECORD::RECORD NOT FOUND IN PUBLIC CONTROLLER#SHOW  along with
> "couldn't find item with ID = 100" .
>
That's what find does. It's up to you to rescue
ActiveRecord::RecordNotFound and do something different

Fred

> This is my show view code:-
>
>                 Id: <%= @album.id %><br/>
>                 Title: <%= @album.title %><br/>
>                 Artist: <%= @album.artist%><br/>
>                 Genre: <%= @album.genre %><br/>
>                 <% end -%><br/>
>
> Can anyone please tell me how to fix this problem ?
>
> Would really appreciate any help.
>
> Many thanks,
>
> derm_w
--~--~---------~--~----~------------~-------~--~----~
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