Hi, I am searching for a way to dynamic validate my models. The solution that I got working is: def after_initialize singleton = class << self; self; end validations = eval(calendar.cofig) validations.each do |val| singleton.class_eval(val) end end On my actual app, I have 2 models class Calendar < ActiveRecord::Base has_many :events end class Event < ActiveRecord::Base belongs_to :calendar def after_initialize singleton = class << self; self; end validations = eval(calendar.config) validations.each do |val| singleton.class_eval(val) end end end As you can see, the validation code that should be added to the Event class lies on the Calendar field "config". Works fine for a existing Event, but doesn''t for a new record. That''s because, at the time that after_initialize is called, the association doesn''t exists yet. I can''t find a way to do that besides putting the config values on Event itself. Any advices? Tks! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.