search for: phone_code

Displaying 3 results from an estimated 3 matches for "phone_code".

2009 May 25
1
Help --- My phone number field saves blank
...5 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. -- Posted via http://www.ruby-forum.com/.
2006 Apr 27
0
DRY validation
..._length :is => 2 a.validates_format :with => /\A[A-Z]+\z/ a.validates_uniqueness end attribute :code_alpha3, :string do |a| a.validates_length :is => 3 a.validates_format :with => /\A[A-Z]+\z/ a.validates_uniqueness end attribute :phone_code, :integer, :allow_nil => true do |a| a.validates_numericality :greater_than_or_equal_to => 1, :less_than_or_equal_to => 9999 end end The advantage of this it DRYs up the validation rules since you don''t have to specify the name of the attribute over and over. Plu...
2006 May 23
11
putting the schema in the model files
THE SCHEMA IN THE MODEL a small write up on ''putting the schema in the model'' This is a write up on an issue best covered in a mailing list thread of Januari 2006 (see the links in the text), I repost it because I think it deserves a place on the agenda. == Why? == I was switching back and forward between the model files and the schema.rb -- off course I have