I believe one of the validations is failing in the case where you update
the user profile. Try using something with bang operator(like 'save!') in
the code where you update the user profile (in the controller) to identify
which validation is failing. ('!' will raise an exception if any validation
is failed).

On Mon, Jan 30, 2012 at 11:01 AM, Kapil Kaligotla <
kapil.kaligo...@magikminds.com> wrote:

> I had created users using devise in rails. I am storing user mobile
> number and land line number for the user profile, by using this code
> it is storing the cell and land line numbers in database but after the
> sign out it is not stored in the database. please tell me whats wrong
> in my code in users.rb
>
>
> before_save :build_telephone
>  before_save :build_cell
>
> validates :code, :presence => true, :numericality => true, :length =>
> { :within => 1..2 }, :on => :update
>  validates :code2, :presence => true, :numericality => true, :length
> => { :within => 2..4 }, :on => :update
>  validates :number, :presence => true, :numericality => true, :length
> => { :within => 1..7 }, :on => :update
>  validates :code1, :presence => true, :numericality => true, :length
> => { :within => 1..2 }, :on => :update
>  validates :number1, :presence => true, :numericality =>
> true, :length => {:minimum => 10, :maximum => 10}, :on => :update
>
> attr_accessor :code,:code2, :number, :code1, :number1
>
> attr_accessible :email, :password,  :password_confirmation,  :mobile,
> :landline, :remember_me , :code, :code2, :number, :code1, :number1
>
> def build_cell
>      self.mobile = "#{self.code1}-#{self.number1}"
>    end
>
>    def build_telephone
>      self.landline = "#{self.code}-#{self.code2}-#{self.number}"
>    end
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


-- 
Thanks,
Prince

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to