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 !