> validate do |applicant| > errors.add_to_base("Things must check out!") unless > applicant.check_things > end > > def before_save > applicant.non_represented_field = 123456789 > end > > before_save will only be called if your validations pass, so > non_represented_field will only be assigned to valid records.
Hi, Thanks for the reply. Sorry, I don't think I expressed myself very well. When I submit the form, every value the applicant has entered is validated and passed to the controller. That means that if they enter a value in the email field (for example) I can access this value in the controller in the params hash, regardless of whether validation failed or passed. As this 'non-represented' field is only getting set after a successful validation, it is not available in the params hash until everything has been filled out correctly. Before that it always shows as nil. I would like to set this value in my model with every form submission (it is a hash which is always a different value per submission) so that it is always available in the params has in the controller. I really appreciate any help. -- 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-t...@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.