# Object.send problem within ActiveRecord

**URL:** <https://www.ruby-forum.com/t/object-send-problem-within-activerecord/123814>\
**Category:** Rails\
**Created:** [December 20, 2007, 10:31pm UTC](https://www.ruby-forum.com/t/object-send-problem-within-activerecord/123814 "2007-12-20T22:31:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabru](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/c0e974/32.png) [@gabru](https://www.ruby-forum.com/u/gabru)\
**Post date:** [December 20, 2007, 10:31pm UTC](https://www.ruby-forum.com/t/object-send-problem-within-activerecord/123814/1 "2007-12-20T22:31:10Z")

</div>

I am using the send method in one of my active records … executing a  
method without any parameters works fine… but when it comes to  
parameters it says

ArgumentError: wrong number of arguments (1 for 0)

u = User.new  
#works  
u.send :firstname  
#does not work =\> ArgumentError: wrong number of arguments (1 for 0)  
u.send :firstname, ‘michal’

does someone know why? the rubydoc says that its possible to call it  
with params also…

---

<div class="post-metadata">

**Author:** ![gabru](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/c0e974/32.png) [@gabru](https://www.ruby-forum.com/u/gabru)\
**Post date:** [December 20, 2007, 11:52pm UTC](https://www.ruby-forum.com/t/object-send-problem-within-activerecord/123814/2 "2007-12-20T23:52:09Z")

</div>

On Dec 21, 2007 8:01 AM, Michal G. \<  
removed\_email\_address@domain.invalid\> wrote:

> #does not work =\> ArgumentError: wrong number of arguments (1 for 0)  
> u.send :firstname, ‘michal’
> 
> ## does someone know why? the rubydoc says that its possible to call it with params also…
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Ryan B.

> **[frozenplague.net](http://www.frozenplague.net)**
>
> This domain may be for sale!

---

<div class="post-metadata">

**Author:** ![gabru](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/c0e974/32.png) [@gabru](https://www.ruby-forum.com/u/gabru)\
**Post date:** [December 20, 2007, 11:52pm UTC](https://www.ruby-forum.com/t/object-send-problem-within-activerecord/123814/3 "2007-12-20T23:52:45Z")

</div>

On 12/20/07, Michal G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> #does not work =\> ArgumentError: wrong number of arguments (1 for 0)  
> u.send :firstname, ‘michal’

u.send ‘firstname=’, ‘michal’

jeremy

---

<div class="post-metadata">

**Author:** ![gabru](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/c0e974/32.png) [@gabru](https://www.ruby-forum.com/u/gabru)\
**Post date:** [December 20, 2007, 11:52pm UTC](https://www.ruby-forum.com/t/object-send-problem-within-activerecord/123814/4 "2007-12-20T23:52:45Z")

</div>

> > p = Party.new  
> > =\>
> 
> > p.send :name  
> > =\> nil

Works for me.

---

<div class="post-metadata">

**Author:** ![gabru](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/c0e974/32.png) [@gabru](https://www.ruby-forum.com/u/gabru)\
**Post date:** [December 20, 2007, 11:54pm UTC](https://www.ruby-forum.com/t/object-send-problem-within-activerecord/123814/5 "2007-12-20T23:54:41Z")

</div>

Jeremy K. wrote:

> On 12/20/07, Michal G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> wrote:
> 
> > #does not work =\> ArgumentError: wrong number of arguments (1 for 0)  
> > u.send :firstname, ‘michal’
> 
> u.send ‘firstname=’, ‘michal’
> 
> jeremy

thanks jeremy that was it.
