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

Seems totally broken on Rails 2.3.2 #2

Open
brookr opened this issue Sep 6, 2009 · 0 comments
Open

Seems totally broken on Rails 2.3.2 #2

brookr opened this issue Sep 6, 2009 · 0 comments

Comments

@brookr
Copy link

brookr commented Sep 6, 2009

First off, THANK YOU for the time you have put into this plugin. This is functionality badly needed in core.

I'm having trouble getting it to work. Not sure if what i'm seeing is version specific, but it is ugly.

Installing the plugin breaks existing has_many :through and has_one :through associations.

The SQL generated for has_many :through is using the wrong value for the join ID (appears to be using the local id, rather than the id of the intermediary model?). I monkey-patched this by changing line 20 lib/nested_has_many_through.rb to:

      "#{@nested_join_attributes[:remote_key]} = #{@owner.send(@nested_join_attributes[:local_key])} #{@nested_join_attributes[:conditions]}"

However, this "fix" breaks has_one :through associations, trying to put the wrong id (the :remote_key, it seems?) on @owner model.

As noted in Issue #1, has_one :through has it's own problems anyway.

I forked, I combed through the code, I did some debug outs, traced what was happening, but could not identify the cause of these issues. Perhaps it is something with the way it is interacting with Rails? Especially Rails 2.3?

There are no references to "has_one" in the plugin, so maybe that just isn't handled at all? Any insights you have would be appreciated.

Again, thank you for taking on the burden of maintaining this essential tool.

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

1 participant