# Belongs\_to not working for me in 2.02?

**URL:** <https://www.ruby-forum.com/t/belongs-to-not-working-for-me-in-2-02/127113>\
**Category:** Rails\
**Created:** [January 25, 2008, 1:58am UTC](https://www.ruby-forum.com/t/belongs-to-not-working-for-me-in-2-02/127113 "2008-01-25T01:58:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3bc359/32.png) [@jon](https://www.ruby-forum.com/u/jon)\
**Post date:** [January 25, 2008, 1:58am UTC](https://www.ruby-forum.com/t/belongs-to-not-working-for-me-in-2-02/127113/1 "2008-01-25T01:58:07Z")

</div>

Hey folks - thanks in advance for any help. I’m in the process of  
upgrading from 1.2.6 to 2.0.2. Everything’s working great in 1.2.6,  
got rid of all deprecation messages, etc. But I’ve been banging my  
head against a wall with this problem and am all Googled out.

I can’t seem to access any information through ANY of my belongs\_to:  
relationships. For example:

In my model I’ve got class Row which belongs\_to :Entity

So in console I can look at a Row object:  
#\<Row:0x3278dd4 @attributes={"\_clean\_name"=\>“Set 8A”, “rating”=\>nil,  
“created\_on”=\>“2006-12-19 18:09:55”, “name”=\>“**Set 8A\</  
strong\>”, “entity\_id”=\>“5”, “guid”=\>“ZAQ-84935”, “creator\_id”=\>“2”,  
“id”=\>“769”}\>**

If I say @row.Entity in my 1.2.6 console I get:  
#\<Entity:0x3249d2c @attributes={“rating\_votes”=\>“0”,  
“uses\_images”=\>“1”, “created\_on”=\>“2006-10-27 00:00:00”,  
“name”=\>“Anker stones”, “singular”=\>nil, “creator\_id”=\>“1”,  
“uses\_table”=\>“0”, “id”=\>“5”, “description”=\>“blah blah”,  
“entity\_type\_id”=\>“2”, “image\_id”=\>“7242”, “name\_rule”=\>"**{Set  
Number}**", “rows\_count”=\>“2”, “base\_id”=\>nil,  
“example\_row\_id”=\>“770”}\>

However, if I say @row.Entity in my 2.0.2 console I get … wait for  
it …  
nil.

This happens any time I try to access a table relationship like that.  
Has anyone else seen anything like this? Have any suggestions?

thanks much!  
Jon

---

<div class="post-metadata">

**Author:** ![jon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3bc359/32.png) [@jon](https://www.ruby-forum.com/u/jon)\
**Post date:** [January 25, 2008, 2:37am UTC](https://www.ruby-forum.com/t/belongs-to-not-working-for-me-in-2-02/127113/2 "2008-01-25T02:37:52Z")

</div>

Try saying belongs\_to :entity instead.

On Jan 25, 2008 11:26 AM, Jon [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> “uses\_table”=\>“0”, “id”=\>“5”, “description”=\>“blah blah”,
> 
> thanks much!  
> Jon
> 
> >

–  
Ryan B.

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

Feel free to add me to MSN and/or GTalk as this email.

---

<div class="post-metadata">

**Author:** ![jon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3bc359/32.png) [@jon](https://www.ruby-forum.com/u/jon)\
**Post date:** [January 25, 2008, 3:32pm UTC](https://www.ruby-forum.com/t/belongs-to-not-working-for-me-in-2-02/127113/3 "2008-01-25T15:32:06Z")

</div>

Wow - that did it. Many thanks, Ryan. Now you willing to come over  
and methodically lowercase every reference to those models in my app?  
No?

J

---

<div class="post-metadata">

**Author:** ![jon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3bc359/32.png) [@jon](https://www.ruby-forum.com/u/jon)\
**Post date:** [February 2, 2008, 7:53am UTC](https://www.ruby-forum.com/t/belongs-to-not-working-for-me-in-2-02/127113/4 "2008-02-02T07:53:20Z")

</div>

Jon wrote:

> Wow - that did it. Many thanks, Ryan. Now you willing to come over  
> and methodically lowercase every reference to those models in my app?  
> No?
> 
> J

And now you will discover the joy of NetBeans/TextMate.
