I have an ‘edit_user’ template that looks like this:
<% form_for :user, @user, :url => { :action => 'edit_user' } do |f|
%>
User Name:
<%= f.text_field :name %>
Full Name:
<%= f.text_field :fullname %>
Password:
<%= f.text_field :password %>
Confirm:
<%= f.text_field :password_confirmation %>
User Role:
<%= select_tag “user[role]”, @options %>
<%= submit_tag "Save Changes", :class => "submit" %>
<% end %>
The problem is that it never displays existing data for the password and
password_confirmation attributes. Password is a virtual attribute that
actually points to a hashed_password in the db, as shown in the AWDWR
book.
This makes things difficult, because if I want to edit a user, I have to
know their existing password.
How do I get a virtual attribute to place it’s value in the above
:password and :password_confirmation boxes?
Thanks!