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

Respect negative conditions for advanced collection associations #752

Closed
janklimo opened this issue Jan 18, 2017 · 1 comment
Closed

Respect negative conditions for advanced collection associations #752

janklimo opened this issue Jan 18, 2017 · 1 comment

Comments

@janklimo
Copy link

janklimo commented Jan 18, 2017

I was trying to use this functionality introduced in #645 with conditional 2nd degree has_many ... through relationships with little success.

In my case:

  • a Course has_many :user_assigned_content_skills, -> { where(source: 'user') }, class_name: "ContentSkill"
  • and a ContentSkill belongs_to :skill and belongs_to :course

Then Course.ransack({user_assigned_content_skills_skill_name_not_eq: 'ruby'}).result.to_sql returns the following (i.e. false positives again if a course has multiple content_skills):

SELECT courses.* 
FROM courses 
LEFT OUTER JOIN content_skills ON content_skills.course_id = courses.id AND content_skills.source = 'user' 
LEFT OUTER JOIN skills ON skills.id = content_skills.skill_id 
WHERE (skills.name != 'ruby')

Any ideas how to achieve this? Is there a plan to have it implemented in Ransack?

Many thanks for any insights!

@scarroll32
Copy link
Member

This issue appears more to be a HOW-TO issue rather than a bug in Ransack. We are in the process of cleaning up the Ransack gem and repo. If this issue is still relevant could you please ask it on StackOverflow?

If you think it is an issue with Ransack, please provide a repo with the issue and / or a pull request with failing tests. If you don't know how to do this, indicate it in the issue and we will look into it eventually.

Thank you

https://github.com/activerecord-hackery/ransack/blob/master/CONTRIBUTING.md

#794

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