Re: [Rails] Problem writing to database using form_for

2010-10-05 Thread Luke Cowell
How about this ? 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

Re: [Rails] Problem writing to database using form_for

2010-10-05 Thread radhames brito
save it in the session hash on validation and delete it from the session hash after the save. if validations fails, try to find the value on the session and putting it in the controller. Since validation will trigger again in a second submit, also look for the value in the session hash before setti

[Rails] Problem writing to database using form_for

2010-10-05 Thread Jim Burgess
Hi, I have a web-based form for applicants to enter their details, created using form_for :applicant There is one field in the corresponding applicants table of my database which is not represented in the form. I want to set the value of this field in the model (it should be an unique hash). Wh