Forum: Ruby on Rails validation with attribute_accessor

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3083ca8f0496edaac2fa10c20630d0bc?d=identicon&s=25 Newb Newb (newb)
on 2009-05-25 11:26
hi
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.
Thanks
3131fcea0a711e5ad89c8d49cc9253b4?d=identicon&s=25 Julian Leviston (Guest)
on 2009-05-25 12:21
(Received via mailing list)
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?

----------------------------------------------
Blog: http://random8.zenunit.com/
Twitter: http://twitter.com/random8r
Learn: http://sensei.zenunit.com/
Latest: How to use Unix basics at http://sensei.zenunit.com/
This topic is locked and can not be replied to.