On Friday 17 April 2009, sweet61 wrote:
> I am imagining keeping data in tables such as the following :-

You know that you can call the ordinary validates_... methods from 
another method?

class Company < ActiveRecord::Base
  include DatabaseValidator
end

module DatabaseValidator
  def self.included(base)
    <read validation specs from db>.each do |vmethod, options|
      base.send(vmethod, options)
    end
  end
end

You could store the validation method simply as the method name and the 
options as a YAML serialized hash.

Michael

-- 
Michael Schuerig
mailto:[email protected]
http://www.schuerig.de/michael/


--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to