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
I have given for validation like below
validates_presence_of :country_code,
:message => ‘*The country code is required.’
@user = UserInfo.new()
phone_code = params[:userinfo][:country_code] +’-’+
params[:userinfo][:phone_code]
@user.name = params[:userinfo][:name]
@user.phone = phone_code
@user.save
when i save,my phone field is blank…
what i m doing wrong…
pls guide me.