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

Issue #1434 filter functionality for has many association. #1437

Closed
wants to merge 4 commits into from

Conversation

barsukov
Copy link

This commit has few changes :

  1. I implement filter functionality for has_many association with issue has_many :through associations filter problem #1434
  2. I refactor one spec with rspec best practices and factory girl too.

@bbenezech
Copy link
Collaborator

Does it really make sense to filter on a HM relation ?
Maybe it would make more sense to do has_one first. Also nested models with Mongoid aren't covered. Maybe @mshibuya wants to give it a try ?
I can't add HM without HMT and HABTM, this would be awkward, and I am not sure it's a good idea anyway.

@barsukov
Copy link
Author

Hm.. Can you explain me what i need to do for compleate this request , I will try to improve my pull request.

@barsukov
Copy link
Author

@bbenezech this implementation work if you set type of association of field to :has_many_association type => HABTM and HMT does not implemented for field but I could be wrong.

@coveralls
Copy link

Coverage decreased (-5.23%) when pulling 2185234 on barsukov:master into 05a029d on sferik:master.

View Details

@coveralls
Copy link

Coverage decreased (-0.25%) when pulling 2185234 on barsukov:master into 05a029d on sferik:master.

View Details

@coveralls
Copy link

Coverage decreased (-0.15%) when pulling 2185234 on barsukov:master into 05a029d on sferik:master.

View Details

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.26%) when pulling cddeb94 on barsukov:master into 0be9e22 on sferik:master.

@rafaelgonzalez
Copy link

@bbenezech

It makes sense to me to have a HM or HABTM filter.

I have a Project model with many Task and want to be able to filter out projects that have tasks with a specific name, or specific content in the name. (in truth it is really a HABTM relationship in my case, so I would like to filter all the projects that have the same task assigned to them but I use has_many :through with an intermediate model)

Please see #1434 were a partial solution has been discussed.

@barsukov
Copy link
Author

I think this is not actual anymore?

@rafaelgonzalez
Copy link

Well the solution I use in #1434 only partially solves my problem (see my comment above), so to me this is still actual.

@mshibuya
Copy link
Member

The same as #1363.

@mshibuya mshibuya closed this Sep 19, 2015
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.

None yet

5 participants