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

Relationship queries: easier to scope/chain #131

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dam13n
Copy link

@dam13n dam13n commented Mar 26, 2016

issue: #130

So after figuring out a workaround, I finally took a look at the specs and noticed this test

it "should be able to use named scopes" do
      cdq(@author).articles.all_published.array.should == [@article1, @article2, @article3]
end

While this can address the problem, I think it could get dirty. For example:

cdq(cdq(@author).articles.all_published.first).comments.positive.array

Instead of easily chaining, you have to cdq() wrap for each depth level.

I modified CDQRelationshipQuery slightly to fix this (not sure if it is a smart way to do it) and added a spec line.

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

Successfully merging this pull request may close these issues.

1 participant