It would also be great, if any one of you could give me certain links on
exceptions which would help me understand its concepts better.
…some arbitrary simple example i can think of; say you have a
ActiveRecord model Item with records in the db ranging from 1-100, and u
search for #101:
Item.find(101) # this raises an exception
rescue ActiveRecord::RecordNotFound # this will catch this specific
flash[:notice]=“the record was not found!”
in this example instead of the app crashing since no record was found,
we send a message to the user via the other_action+flash message.
the syntax of the rescue clauses are pretty simple; if you have the name
of the Exception you can rescue that SPECIFIC exception like the example
if you want to catch any old exception (doesn’t matter what the reason
is) you can just write “rescue” without anything appended.
you can also do multiple resuces, with each rescue rescuing a certain
hope the link helps out too.