Kelly Dwight Felkins
2006-Jan-14 20:46 UTC
[Rails] form fields WITHOUT table columns? Can we validate these in the model?
I would like to have a field on a form that does *not* have an underlying column in the table. Yet I would like to perform some validation on the value. I would like the results of the validation to show up just like the validations that are performed in the model. This is very similar to the password_confirmation field on a sign up screen. The password_confirmation is there on the screen, but probably not in the underlying table. Also, you can have validations associated with the confirmation field, like "validates_presence_of". How is this done? Thank you. -Kelly -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060114/2640314e/attachment.html
Kelly Dwight Felkins
2006-Jan-14 21:11 UTC
[Rails] Re: form fields WITHOUT table columns? Can we validate these in the model?
Answering my own question: Apparently you can simply add the method to the model... I did this with attr_accessor and things are working great. -Kelly On 1/14/06, Kelly Dwight Felkins <railsinator@gmail.com> wrote:> > I would like to have a field on a form that does *not* have an underlying > column in the table. > > Yet I would like to perform some validation on the value. I would like the > results of the validation to show up > just like the validations that are performed in the model. > > This is very similar to the password_confirmation field on a sign up > screen. The password_confirmation is > there on the screen, but probably not in the underlying table. Also, you > can have validations associated > with the confirmation field, like "validates_presence_of". > > How is this done? > > Thank you. > > -Kelly > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060114/4309ce91/attachment.html
Maybe Matching Threads
- wrong id for activerecord object when using :joins in mysql
- inexpensive ways to make a rails application highly available? mysql replication?
- scgi apache routes help needed
- Easy way of dealing with nil properties in templates?
- is there really a restart task in switchtower? How do you invoke it?