undefined method assert_valid_keys in Rails

If you are getting an error about ‘undefined method assert_valid_keys’ in Rails , eg :

undefined method `assert_valid_keys' for :time_entry_product:Symbol 

… it may be because you have two relationships specified on the same line in your model :

class TimeEntry < ActiveRecord::Base
  belongs_to :time_entry_category, :time_entry_product
end

If you change this so that the relationships are on separate lines, the problem should go away :

class TimeEntry < ActiveRecord::Base
  belongs_to :time_entry_category
  belongs_to :time_entry_product
end



No Responses to “undefined method assert_valid_keys in Rails”  

Leave a Reply