Need support for has_many through with has_one in the “bridge table”

Let me expose the problem with an example :

Cart model (as in : shopping cart)

Bill model


Basically, because the “through” table links the destination table with a has_one relationship, ActiveRecord complains with : Invalid source reflection macro :has_one for has_many :bills, :through => :carts. Use :source to specify the source reflection.

Someone on Rails Trac already created a ticket about this issue 2 years ago. Can we expect this feature to be officially supported in the future? Let’s hope so.

  • Tim Haines

    I think the rails core crew would welcome a patch for this. ;-)

  • Pratik

    What Time said :) Please submit the patch with tests on LightHouse.

  • Frank

    Hey guys,

    You’re right, I’ll do that

  • Andrew Stott

    Hey, Frank. Any updates on this?

    I was searching through Lighthouse for a ticket/patch but didn’t have any success. I’m looking for a patch re: this, too, I just don’t want to duplicate any effort… Thanks much !