Hi,
When I am trying to update customer’s details (or even when trying to
create a new customer) I get this error:
ArgumentError in Admin/customerController#create
wrong number of arguments (0 for 1)
app/controllers/admin/customer_controller.rb:29:in password' app/controllers/admin/customer_controller.rb:29:in
create’
My customer.rb class has:
def password(value)
write_attribute(“password”, Digest::SHA1.hexdigest(value))
end
My customer_controller.rb has:
def create
c = Customer.new(params[:customer])
if c.save
flash[:notice] = ‘Customer was successfully created.’
redirect_to :action => ‘list’
else
render :action => ‘new’
end
end
def edit
@page_title = ‘Editing Customer’
@customer = Customer.find(params[:id])
end
def update
@customer = Customer.find(params[:id])
if @customer.update_attributes(params[:customer])
flash[:notice] = ‘Customer was successfully updated.’
redirect_to :action => ‘show’, :id => @customer
else
render :action => ‘edit’
end
end
And my _form.rb has:
Name
<%= text_field 'customer', 'name' %>
Password
<%= password_field 'customer', 'password' %>
<%= text_field 'customer', 'email' %>
Why doesn’t it see the parameters I’m trying to send it?
why is the error happening?
TIA,
Elle