I am dealing with some weird stuff. I am looking at request.env['recaptcha.valid']
a special key I added to the request variable available only to Rails controllers.
Depending on the state of the above variable, how can I raise a rails validation error from the Rails controller rather than dealing with this logic in the Model?
Look into
before_filter
, which can choose to render or redirect, or simply set some internal state (@captcha_failed = true
) before your action is invoked.You might want something like this: