Skip to content

Commit

Permalink
Add failing spec for Github issue #88
Browse files Browse the repository at this point in the history
  • Loading branch information
nertzy committed May 1, 2015
1 parent 812fc33 commit 2251211
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions spec/integration/associations_spec.rb
Expand Up @@ -514,4 +514,30 @@
expect(results).not_to include(*excluded)
end
end

describe "a scope that uses :associated_against and is chained onto another scope that joins to the same association" do
with_model :Parent do
model do
include PgSearch
has_one :child
pg_search_scope :search, associated_against: {:child => :name}
def self.enabled
joins(:child).where(:children => {:enabled => true})
end
end
end

with_model :Child do
table do |t|
t.string :name
t.belongs_to :parent
end
end

it "should not raise an exception" do
expect {
Parent.search("test").enabled.all
}.not_to raise_exception
end
end
end

0 comments on commit 2251211

Please sign in to comment.