On 12 September 2012 12:44, honey ruby <
emailtoh...@gmail.com> 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
That # in the middle looks a bit odd. Did you mean it to be there?
>
> 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
If the code you have posted for the model is not copied/pasted then
please do that (so we can check for typos), also post the code for the
controller action run when you click submit (just that action will
do), and also post the section of development.log for when you clck
submit (look at the log before you click submit to see where to start
the copy/paste from).
Maybe better to have a look at the Rails Guide on debugging first
though to find out how to debug the code, then see if you can work it
out for yourself.
Colin