# Wrong number of arguments (0 for 1)

**URL:** <https://www.ruby-forum.com/t/wrong-number-of-arguments-0-for-1/118155>\
**Category:** Rails\
**Created:** [October 24, 2007, 11:30am UTC](https://www.ruby-forum.com/t/wrong-number-of-arguments-0-for-1/118155 "2007-10-24T11:30:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ccd318/32.png) [@elle](https://www.ruby-forum.com/u/elle)\
**Post date:** [October 24, 2007, 11:30am UTC](https://www.ruby-forum.com/t/wrong-number-of-arguments-0-for-1/118155/1 "2007-10-24T11:30:10Z")

</div>

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' %\>

Email

\<%= text\_field 'customer', 'email' %\>

Why doesn’t it see the parameters I’m trying to send it?  
why is the error happening?

TIA,  
Elle

---

<div class="post-metadata">

**Author:** ![elle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ccd318/32.png) [@elle](https://www.ruby-forum.com/u/elle)\
**Post date:** [October 24, 2007, 11:37am UTC](https://www.ruby-forum.com/t/wrong-number-of-arguments-0-for-1/118155/2 "2007-10-24T11:37:11Z")

</div>

On 24 Oct 2007, at 10:29, elle wrote:

> 

I suspect the problem is that you’ve called your setter method  
password instead of password=, which will cause problems when rails  
tries to read the password (eg when displaying the form).

Fred

---

<div class="post-metadata">

**Author:** ![elle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ccd318/32.png) [@elle](https://www.ruby-forum.com/u/elle)\
**Post date:** [October 24, 2007, 11:47am UTC](https://www.ruby-forum.com/t/wrong-number-of-arguments-0-for-1/118155/3 "2007-10-24T11:47:43Z")

</div>

> I suspect the problem is that you’ve called your setter method  
> password instead of password=, which will cause problems when rails  
> tries to read the password (eg when displaying the form).

Thanks Fred. You are right and it is fixed.  
Cheers,  
Elle
