I''ve scoured the web for solution, but I can''t figure out why this is not working! I have a terms and conditions check box that user has to check in order to register with a site, but it seems to just let user register regardless of the check box status. Here''s what I have: ----------------------------------------- Model: validates_acceptance_of :terms_and_conditions, :on => :create, :message => "must be accepted." attr_accessible :terms_and_conditions ----------------------------------------- View(form): <%= form.check_box :terms_and_conditions %> ----------------------------------------- LOG: (skipping other fields with "..." to save space) Parameters: {"action"=>"create", ..., "user"=>{... , "terms_and_conditions"=>"0",... }} ----------------------------------------- I am seeing in the log (as shown above) that the "terms_and_conditions"=>"0", when I don''t check the box, and "terms_and_conditions"=>"1", when I check the box. But either way, it just goes ahead and creates the record, and no warning when I don''t check the box. What am I doing wrong? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
khagimoto
2010-Sep-29 17:18 UTC
Re: validates_acceptance_of with virtual attribute check box
Never mind.. I found out that at "save", terms_and_conditions was not being set and that was the problem! Everything works fine now. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.