Hi -

So, I have a user model, with a bunch of validations, one of which is
validates_acceptance_of :terms_of_service. I've decided to keep a
database column tracking this attribute, and it works just as intended
for signups (people have to check the box before they can register).

However, a user may also be created via an admin interface, which has an
entirely separate controller and view. When a user is created via this
interface, I'd like to keep most of the validations intact (ensuring
that the name and email are unique, that the password is confirmed,
etc.) but there are some validations that I'd like to skip and not be
bothered by (for example, the terms of service checkbox).

I'm not sure how to make this happen. I've played with the :if and
:unless options for the validation helpers, but as far as I can tell
they're only able to see the instance variables belonging to the user
I'm validating. It would be great if I could say validates_acceptance_of
:terms_of_service, :unless => { :controller => 'admin/users' } or
something similar, but that doesn't seem to be a possibility.

Does anyone have any ideas as to how I could make this work?

Thanks!
Chris
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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