Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- scope :admins, -> { joins(:user).where('users.role = ?', '1') }
- scope :users_and_approved, -> { joins(:user).where('users.role = ? AND approved = ?', '0', true) }
- def self.index_services
- admins = Service.admins.order({ updated_at: :desc })
- users = Service.users_and_approved.order({ updated_at: :desc })
- admins.or(users)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement