# Little Rails Bug - does it still exist?

**URL:** <https://www.ruby-forum.com/t/little-rails-bug-does-it-still-exist/110477>\
**Category:** Rails\
**Created:** [July 26, 2007, 6:07pm UTC](https://www.ruby-forum.com/t/little-rails-bug-does-it-still-exist/110477 "2007-07-26T18:07:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e47c2d/32.png) [@nex](https://www.ruby-forum.com/u/nex)\
**Post date:** [July 26, 2007, 6:07pm UTC](https://www.ruby-forum.com/t/little-rails-bug-does-it-still-exist/110477/1 "2007-07-26T18:07:58Z")

</div>

I came across a little Rails gotcha recently, something that was  
reported back at least a year ago. I was wondering whether anyone  
could help me find my way through the bug tracker and see if there was  
progress on it (I am new to Rails).

Here is the bug:

You cannot go through a :through association and set a field like  
this:

> paper1.relations\_as\_source.find\_by\_id(1).note = “Something”  
> That will return ok, but NOT GET SET!

You have to have an intermediary variable first:

> rel = paper1.relations\_as\_source.find\_by\_id(1)  
> rel.note = “Something”

I would like to ask whether anyone knew the background to this bug (is  
this intended to work this way, and if so, why?) but of course this  
may be covered in the bug-tracker, so if anyone can help me find it,  
that would be great as I’d like to keep tabs on this one.

Many many thanks,

- Nex

---

<div class="post-metadata">

**Author:** ![nex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e47c2d/32.png) [@nex](https://www.ruby-forum.com/u/nex)\
**Post date:** [July 26, 2007, 6:09pm UTC](https://www.ruby-forum.com/t/little-rails-bug-does-it-still-exist/110477/2 "2007-07-26T18:09:58Z")

</div>

Not a bug. The var= operator does not save information to the database,  
so  
your first line is basically wasted resources. You want:

paper1.relations\_as\_source.find\_by\_id(1).update\_attributes(:note =\>  
“Something”)

Jason

---

<div class="post-metadata">

**Author:** ![nex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e47c2d/32.png) [@nex](https://www.ruby-forum.com/u/nex)\
**Post date:** [July 26, 2007, 6:15pm UTC](https://www.ruby-forum.com/t/little-rails-bug-does-it-still-exist/110477/3 "2007-07-26T18:15:59Z")

</div>

Ah fantastic - thanks (new to Ruby and Rails).

Cheers for the info,

- Nex
