Hello,

On Wednesday, September 12, 2012 5:14:07 PM UTC+5:30, honey ruby wrote:
>
> Hi all i am learning Rails3.2.7 but by ActiveRecords Validations are not 
> working.
>
> These are my User.rb
>
>  class User < ActiveRecord::Base 
>      attr_accessible :password, :fullname,:user_name 
> ,:email,:company_name#,:terms_of_service,:password_confirmation 
>

For this : - First remove the # after  :company_name.
For :password_confirmation, you should also add :-
        attr_accessor  :password_confirmation. (because it is not going to 
be saved in db.)

Hope this helps.  

 
>     validates :terms_of_service, :acceptance => { :accept => 'yes' } 
>       validates :password ,:confirmation => true 
>       validates :password_confirmation, :presence => true 
>       validates :fullname ,:presence => true 
>       validates :user_name ,:presence => true 
>       validates :email ,:presence => true 
>       validates :company_name ,:presence => true 
>      
>  
>      
> end
>
> but when i click Submit button with out entering the data my validations 
> are not working i'm not getting errors messages which is default in 
> rails.Can any one tell where did i go wrong
>
>
> Thanks in advance
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/d-QJym4qYc8J.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to