There are several related questions to this one. But none of the answers address my situation.
I am getting this error on my localhost when trying to create a new policy.
Can't mass-assign protected attributes: starts_on
In my policy.rb model though I have this:
class Policy < ActiveRecord::Base
belongs_to :policy_type
attr_accessible :starts_on,
:ends_on,
:i_agree_privacy_policy,
:license,
.
.
.etc...
validates:starts_on, :presence => true
def self.init(user, policy_type, load_user_profile = true)
attributes = {
:user => user,
:policy_type => policy_type,
:starts_on => Date.today
}
policy_type.policy_class.constantize.new(attributes)
end
etc...
end
The form is for insurance so its huge but its also not important here since I am creating the starts_on here with Date.today. Really stumped here and I've spent several hours on google the last couple of days to figure out why this is happening.