On May 20, 10:17 pm, Matt Jones <[email protected]> wrote:
> This may be a dumb question, but what version of Rails are you on? I
> know that versions earlier than 2.2.2 had some difficulties with
> has_one :through...
>
Yeah, I was looking at some related bug fixes, but I think they are
all incorporated. I'm using 2.3.2. There are a couple things I'll
try later tonight when I have a chance to look again:
First, the debugger is giving me something strange in the
AssociationProxy class in the reload method. After calling reset (it
uses AssociationCollection#reset) @loaded == true according to the
debugger. If loaded really is true, it might expliain this, but I'm
still under the assumption that I'm misinterpreting the debugger, or
the debugger is wrong, because otherwise I misunderstand inheritance
in ruby and there's a bug in rails (this seems less likely). I
haven't been able to duplicate this with a smaller repro, but I'll try
again tonight.
Second, I think it's very likely that my scenario isn't all that
common. And it's very likely that the association implementation
wasn't designed with this in mind. I'm running into this in a unit
test. Instead of creating models in memory, I'll load up data from
the test DB, and I'm guessing user.roles suddenly starts working.
Then at least I know I can work around the problem with test fixtures.
In the meantime, if anyone else has an idea of what's going on, let me
know.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---