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).

What is the best way to do this?

Currently I am doing:

validate do |applicant|
  applicant.check_things
  applicant.non_represented_field = 123456789
end

This works, but the value assigned to the 'non-represented' field is
only available after the applicants details have been successfully
saved.

If validation fails (i.e. if an obligatory field was omitted), this
value is showing up in the hash of values that is posted to the
controller as nil (which is bad as I always want it to be set).

I would be grateful if anyone could give me an idea how to solve this.
The only other thing I could think of was setting it with some kind of
call back, but I couldn't get that to work.

Thanks in advance.
-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to