-
-
Notifications
You must be signed in to change notification settings - Fork 809
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue with self joins and includes (#1275)
Our polyamorous monkeypatches were doing too much. Removing our custom equality and letting ActiveRecord figure it out seems to do the trick and fix this. On some Rails & DB adapters this seems to break a polyamorous spec. However, this spec just tests an implementation detail but it's unclear whether the spec breaking has any actual bad side effect in real like, so I removed it.
- Loading branch information
1 parent
49a43fc
commit a6f91a4
Showing
5 changed files
with
25 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'spec_helper' | ||
|
||
module Polyamorous | ||
describe "ActiveRecord Compatibility" do | ||
it 'works with self joins and includes' do | ||
trade_account = Account.create! | ||
Account.create!(trade_account: trade_account) | ||
|
||
accounts = Account.joins(:trade_account).includes(:trade_account, :agent_account) | ||
account = accounts.first | ||
|
||
expect(account.agent_account).to be_nil | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters