Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breaks has_one :through #1

Open
KevinMonk opened this issue Aug 14, 2009 · 3 comments
Open

breaks has_one :through #1

KevinMonk opened this issue Aug 14, 2009 · 3 comments

Comments

@KevinMonk
Copy link

This is my first time posting an issue on any open source project so apologies if it's not done in the usual format.

I have a model like this:

class GradeGrade < ActiveRecord::Base
belongs_to :grade_item, :foreign_key => :itemid
has_one :moodle_course, :through => :grade_item ### This is broken by nested has many
end

In the console I could do the following:
g = GradeGrade.find(26)
g.moodle_course

It works fine without this plugin installed and shows this:
Mysql::Error: Unknown column 'mdl_course.grade_grade_id' in 'where clause': SELECT mdl_course.* FROM mdl_course WHERE (mdl_course.grade_grade_id = 26 )
when I install nested_has_many_through plugin.

Would love to help fix this but dont feel I have the expertise. Hope one of you bright chaps can help sort it out.

Regards,

Kevin.

@gordonbisnor
Copy link

Broke my has one too....

class Artist < User
has_many :agents_artists, :dependent => :destroy
has_many :agents, :through => :agents_artists
has_one :primary_agent, :through => :agents_artists, :conditions => ["agents_artists.primary_agent = ?",true] , :source => :agent

@KevinMonk
Copy link
Author

I got it working by using one of the other forks. I think it may have been JackDanger or logophobia. I can't remember which one now. There's a reference to it in one of the commit messages.

@gordonbisnor
Copy link

Thanks, yes, I checked out the lighthouse site for this plugin and someone mentioned that there was a fork that worked and it did.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants