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
Cheers for the info,
- Nex
On Jul 26, 5:09 pm, "Jason Roelofs" <jameskil...@gmail.com> wrote:
> 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
>