views:

174

answers:

0

In my every model i have 10 or more lines for self.errors.add_to_base. is there any other way i can manage those lines in more easy way? will it possible to manage those errors with some common function which can handle self.errors.add_to_base for any of my model?

 Function like
 def error_add_to_base(message,conditions)
   self.errors.add_to_base(message) if eval("#{conditions}")
 end