hi
when i want to update a user i have this error:
ArgumentError in UsersController#update
Unknown key(s): encrypted_password, username, sign_in_count, email
Rails.root: /home/delmed/servadmin
Application Trace | Framework Trace | Full Trace
app/controllers/users_controller.rb:24:in update' lib/chrome_frame.rb:39:in
call’
Request
Parameters:
{“commit”=>“Modifier ce User”,
“authenticity_token”=>“Z3PXWLIzHcu5nLm06ntenZA+yj8plf3kXrXQ17bjm2E=”,
“_method”=>“put”,
“utf8”=>“✓”,
“id”=>“1”,
“user”=>{“encrypted_password”=>"[FILTERED]",
“username”=>“user1”,
“sign_in_count”=>“1”,
“email”=>“[email protected]”}}
in all these parametre are in the db in users table.
in the controller i have:
def edit
@user = User.find(params[:id])
render :layout => ‘test’
end
def update
@user = User.find(params[:user])
if @user.update_attributes(params[:user])
falsh[:notice] = 'User was successfully updated.'
else
falsh[:notice] = 'Problem update.'
end
redirect_to :action => 'index', :controller => 'user_admins'
end
and in the view:
<%= form_for(@user) do |f| %>
<% if @user.errors.any? %>
<%= pluralize(@user.errors.count, “error”) %> prohibited
this user from being saved:
<ul>
<% @user.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<%= f.text_field :username %>
<%= f.label :pwd %>
<%= f.text_field :encrypted_password %>
<%= f.label :email %>
<%= f.text_field :email %>
<%= f.label :sign_in_count %>
<%= f.text_field :sign_in_count %>
please can you help me!?