#2 open
Jeremy Huffman

Breaks has_one :through

Reported by Jeremy Huffman | February 4th, 2009 @ 01:50 AM

I have some code like this. Your most excellent plug-in makes the third line possible, but then introduces an error in the 2nd line which works fine without the plug-in. The error looks like what you see in the 3rd line without the plug-in (unknown column...)

I changed the domain terms to make this more familiar, hopefully you can see what I mean from this.

@@@ruby has_many :tasks, :through => :projects has_one :primary_task, :through => :projects, :source => :tasks, :conditions => 'tasks.primary = true' has_many :task_items, :through => :tasks

Comments and changes to this ticket

  • Jeremy Huffman

    Jeremy Huffman February 4th, 2009 @ 01:53 AM

    retry formatting failure...

    has_many :tasks, :through => :projects has_one :primary_task, :through => :projects, :source => :tasks, :conditions => 'tasks.primary = true' has_many :task_items, :through => :tasks

  • Jeremy Huffman

    Jeremy Huffman February 4th, 2009 @ 01:54 AM

    last try...

    has_many :tasks, :through => :projects

    has_one :primary_task, :through => :projects, :source => :tasks, :conditions => 'tasks.primary = true'

    has_many :task_items, :through => :tasks

  • Ian White

    Ian White February 4th, 2009 @ 04:35 PM

    • State changed from “new” to “open”

    That sounds bad! thanks for the report, what rails version etc?

    Any chance of forking and adding a failing spec, to get things going?

  • jopotts

    jopotts April 20th, 2009 @ 06:29 PM

    I've just run into the same problem as Jeremy.

    Has anyone looked into this yet?

  • Matt Scilipoti

    Matt Scilipoti July 30th, 2009 @ 06:29 PM

    It looks like janmejay answered it in Sept. 2008: http://github.com/janmejay/nested_has_many_through/tree/master.

    Since JackDanger forked janmejay AND has commits for rails 2.3, I changed my plugin to use his: git://github.com/JackDanger/nested_has_many_through.git. This one is working fine for me.

    Hope this helps.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป