I have a phone field in my table.
But in my form i have two text boxes to get the phone number and the
country code like below
Enter country code ----- Enter phone code ------
In my table i have to save the phone code field after joining the above
values with "-" symbol.
Example => 0225-25874255
I dont have table field for country_code .
So i created like below
attr_accessor :phone , :country_code
You don't need attr_accessor for :phone since you already have a phone
column (if i understand correctly). When used like this attr_accessor
overwrites the accessors that ActiveRecord provides.