Validation with attribute_accessor

I want to get country code for phone numbers in my form.
I dont have database 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.’

but it doesnot show the above validation message …
what i should do…
pls help me.

There’s no reason it should do that that I can think of. Which version
of Rails are you using?

Perhaps you’re running in production mode and you forgot to reset your
webserver after you’ve changed your model?

Latest: How to use Unix basics at