heartcombo/has_scope

scope with nested resources

ausminternet opened this issue · 1 comments

Hi there,

I have tasks and labels with a habtm-relationship.
I would like to pass a param labelwith the label id and get all tasks with this label.

Is this possible? Can anybody show me, how the scope could look like?

(bonus question: is this even possible with an array of id's to get tasks with all of the passed label ids?)

thx in advanced!

If I got your question correctly, you just need to have a scope like:

scope :by_label, -> label_ids { where(label_id: label_ids) }`

Or something like that, it can be a single id or an array of ids.

Please use stack overflow or some other medium for questions, we reserve the issues tracker for issues. Thanks!