attr_accessor problems


I have a model (Person) with an attr_accessor defined variable (copy_employer_address) which is used as a field in a form (checkbox/ boolean).

When the form is submitted the value of the field is there in params but does not appear to be available to my model instance after a mass assignment ([:person] or @person.update_attributes(params[:person]).

I am trying to access the variable from within another instance method using self.copy_employer_address.

I do not have attr_accesssible on the model directly but the acts_as_ferret and acts_as_taggable macros are present.

Is what I am trying to do valid, i.e. should "attr_accessor :variable_name" allow "self.variable_name" when mass assigning from params ?



I think I know the answer,

The method in which I am trying to access the copy_employer_address vaiable is a setter method also invoked by the same mass assignment, so the order in which the elements of params[:person] appear mean that the copy_employer_address variable has not been populated at the time I am trying to access it. I will move the logic into a before_save callback.