Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

Using squeel with existing scopes ? #402

Open
letronje opened this issue Oct 8, 2015 · 1 comment
Open

Using squeel with existing scopes ? #402

letronje opened this issue Oct 8, 2015 · 1 comment

Comments

@letronje
Copy link

letronje commented Oct 8, 2015

'Order' has_one 'Schedule', 'Schedule' belongs_to 'Order'

Order has a scope called 'active' ( active => true )

How do i reuse that scope in the following scope in Schedule ?

scope :xyz, -> {
where{ { schedule_type: 'blah'} | Use_Order_active_scope_here }
}

I intend to use it like this:

Schedule.eager_load(:order).xyz.count

@vendethiel
Copy link

I think you're supposed to use sifters instead

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants