views:

33

answers:

1

I have an additional member method (and a corresponding route) called download, for which I'd like to validate the existence of a password field. Putting :validates_presence_of :password in my download method, I get an error claiming it's an undefined method.

Is this possible?

+2  A: 

No, you can add errors to the model but validations live in the model. Check out the errors methods and add_to_base if you need to add errors in the controller for whatever reason.

Chuck Vose
I understand. Thank you!
yuval