Forum: Ruby on Rails how to give back the hand to AR error handling ?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
nico i. (Guest)
on 2008-11-18 20:18
In controller I use to raise some specific error as follows :

include CustomErrors

rescue_from NoGuestFound,NoHostFound,NoInvitation,WrongPass do |e|
  flash[:message] = e.message
  redirect_to :action => :index
end

def lambda
  ...
  @guest.is_invited_by?(@host) or raise CustomError1.new 'context
message'
  ...
end


I find this way of doing pretty OK, but for AR model validation I'd like
to give back the end to the Active Record standard validation process. I
can't find good doc on how to do so and how AR validation works
exactly...

if anybody has a better way to deal with error handling or if you could
give me some smart links, would appreciate !
This topic is locked and can not be replied to.