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”
class Department < ActiveRecord::Base
unless self.find_by_id(id) error.add(:id, “is invalid department”)
However when I try to save an employee with some test department ‘578’,
get the following error because of validates_associated in employee
“undefined method `valid?’ for “578”:String”
Any ideas what could be causing this?