# Model Commands

**URL:** <https://www.ruby-forum.com/t/model-commands/130618>\
**Category:** Ruby\
**Created:** [February 29, 2008, 10:02pm UTC](https://www.ruby-forum.com/t/model-commands/130618 "2008-02-29T22:02:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mariko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecc23a/32.png) [@mariko](https://www.ruby-forum.com/u/mariko)\
**Post date:** [February 29, 2008, 10:02pm UTC](https://www.ruby-forum.com/t/model-commands/130618/1 "2008-02-29T22:02:03Z")

</div>

I’d like to do something like this in my RoR code:

name = “james”  
box = Box.find(1)  
box\_name = box.name

Where “james” is an existing column in table Box. I try to do this but  
RoR tells me “undefined method `name’ for #Box:0x333a81c”. Is it  
possible to get around this? Basically what I have is a list of strings  
that I need to use as column commands.

Thanks in advance for any help.

---

<div class="post-metadata">

**Author:** ![mariko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecc23a/32.png) [@mariko](https://www.ruby-forum.com/u/mariko)\
**Post date:** [February 29, 2008, 10:10pm UTC](https://www.ruby-forum.com/t/model-commands/130618/2 "2008-02-29T22:10:03Z")

</div>

On Feb 29, 2008, at 10:01 PM, Mariko C. wrote:

> strings  
> that I need to use as column commands.
> 
> ## Thanks in advance for any help.
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

You want to send a message with to the method “james”. What you are  
doing is sending a message to the method “name”.

What you want to do is:

=== code ===

name = “james”  
box = Box.find(1)  
box\_name = box.send(name)

=== code ===

I don’t know what you want to acomplish, but this is how it works.

Greetings  
Florian G.

---

<div class="post-metadata">

**Author:** ![mariko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecc23a/32.png) [@mariko](https://www.ruby-forum.com/u/mariko)\
**Post date:** [February 29, 2008, 10:30pm UTC](https://www.ruby-forum.com/t/model-commands/130618/3 "2008-02-29T22:30:01Z")

</div>

That works perfectly. Many thanks for your quick response!
