Flowdock

Notes posted by jqr

RSS feed
February 14, 2009
1 thank

Clear and simple rescue

noxyu3m, your code is rescuing all exceptions, not just ActiveRecord::RecordInvalid.

I think this syntax is a bit more clear than using the global variable.

def create
  @model = Model.new(params[:model)
  @model.save!
rescue => err                          # rescues all exceptions
  logger.error(err.to_s)
end