Forum: Ruby on Rails Validate a model with a session parameter

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jérôme L (Guest)
on 2006-03-12 16:40
(Received via mailing list)
Hi

I've set a tableless model for a contact form with this instruction:

validates_format_of :captcha,
                     :with =>
ActionController::SessionManagement::session[:captcha],
                     :message => "Security code is wrong. Please enter
it again"

Unfortunately it raises an undefinied method error; is the session
call incorrect or is it just impossible to validate such a thing ? I
don't know how to do it directly inside the controller since
Contact.errors.add_to_base initiate to zero the errors array.

Thanks for your help
This topic is locked and can not be replied to.