model validates against system values table

James Byrne wrote:

class Party << ActiveRecord::Base

   validate :check_party_type

   def check_party-type      errors.add-to_base("Party type #{self.party_type} is not found.") unless        SystemValue.exists?(:table_name => :parties,                            :table_column_name => :party_type,                            :value_as_char => self.party_type.to_s                            )    end

Comments most welcome.

Your approach is perfectly valid according to me, the only other option I can think of is to have a db trigger that checks the field against another table on insert but then you will not get the nicely formated error string that you are producing now.