Forum: Ruby on Rails validation question

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Daniel S. (Guest)
on 2007-01-24 03:28
This one I cant seem to wrap my head around...

I have a form that I would like to bring up a :confirm => "are you sure
you want to change your username, doing so may make you foo up."
but only if a user changes that particular field.

So basically I have:
            <th><label for="user_name">User name</label></th>
            <td><%= f.text_field 'name' %></td>
            <th><label for="user_email">Email</label></th>
            <td><%= f.text_field 'email' %></td>
          <tr><%= submit_tag("Save changes") %></tr>

is there something as easy as
validates_change_of :user_name

and if not, what would be a good suggestion an approaching this.

(that would be a nice validates addition if it doesnt exist!)

This topic is locked and can not be replied to.