Skip to content

Gem breaks has_many -> :through belongs_to association #2

@braindeaf

Description

@braindeaf

I've been having issues with this for the past few days now.

class Entry < ActiveRecord::Base
belongs_to :quiz
has_many :questions, :through => :quiz
end

class Quiz < ActiveRecord::Base
has_many :questions
end

class Question < ActiveRecord::Base
belongs_to :quiz
end

Entry.first.quiz.questions works

but

Entry.first.questions causes a StackLevelTooDeep error. Any ideas? I'm using Rails 3.0.8, and the nested_has_many_through 0.0.2.

from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.8/lib/active_record/associations/through_association_scope.rb:95:in `construct_owner_attributes'
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.8/lib/active_record/associations/through_association_scope.rb:9:in `construct_scope'
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.8/lib/active_record/associations/association_collection.rb:440:in `method_missing'
from /Library/Ruby/Gems/1.8/gems/nested_has_many_through-0.0.2/lib/nested_has_many_through/association.rb:8:in `construct_conditions'
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.8/lib/active_record/associations/through_association_scope.rb:10:in `construct_scope'
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.8/lib/active_record/associations/association_collection.rb:440:in `method_missing'
from /Library/Ruby/Gems/1.8/gems/nested_has_many_through-0.0.2/lib/nested_has_many_through/association.rb:8:in `construct_conditions'
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.8/lib/active_record/associations/through_association_scope.rb:10:in `construct_scope'
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.8/lib/active_record/associations/association_collection.rb:440:in `method_missing'
from /Library/Ruby/Gems/1.8/gems/nested_has_many_through-0.0.2/lib/nested_has_many_through/association.rb:8:in `construct_conditions'
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.8/lib/active_record/associations/through_association_scope.rb:10:in `construct_scope'
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.8/lib/active_record/associations/association_collection.rb:440:in `method_missing'
from /Library/Ruby/Gems/1.8/gems/nested_has_many_through-0.0.2/lib/nested_has_many_through/association.rb:8:in `construct_conditions'

    ................etc etc etc

from /Library/Ruby/Gems/1.8/gems/nested_has_many_through-0.0.2/lib/nested_has_many_through/association.rb:8:in `construct_conditions'
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.8/lib/active_record/associations/has_many_through_association.rb:95:in `construct_sql'
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.8/lib/active_record/associations/association_collection.rb:24:in `initialize'
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.8/lib/active_record/associations/has_many_association.rb:11:in `initialize'
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.8/lib/active_record/associations.rb:1483:in `new'
from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.8/lib/active_record/associations.rb:1483:in `questions'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions