Forum: Ruby on Rails form fields WITHOUT table columns? Can we validate these in

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.
Kelly Dwight F. (Guest)
on 2006-01-21 16:40
(Received via mailing list)
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
Kelly Dwight F. (Guest)
on 2006-01-21 16:40
(Received via mailing list)
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
This topic is locked and can not be replied to.