search for: foregin_key

Displaying 1 result from an estimated 1 matches for "foregin_key".

2006 Mar 13
3
validates_associated problem
Hello, I have a situation where an ''employee'' belongs to a ''department'' and have setup the relationship as follows. class Employee < ActiveRecord::Base belongs_to :department, :foregin_key => "department_id" validates_associated :department_id end class Department < ActiveRecord::Base has_many :employees def validate_on_update unless self.find_by_id(id) error.add(:id, "is invalid department") end end However when I try to save an employee wit...