Class: Pageflow::EntryRoleQuery::Scope
- Inherits:
-
Object
- Object
- Pageflow::EntryRoleQuery::Scope
- Defined in:
- app/models/pageflow/entry_role_query.rb
Instance Attribute Summary collapse
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(user, scope) ⇒ Scope
constructor
A new instance of Scope.
- #with_role_at_least(role) ⇒ Object
Constructor Details
#initialize(user, scope) ⇒ Scope
Returns a new instance of Scope.
6 7 8 9 |
# File 'app/models/pageflow/entry_role_query.rb', line 6 def initialize(user, scope) @user = user @scope = scope end |
Instance Attribute Details
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
4 5 6 |
# File 'app/models/pageflow/entry_role_query.rb', line 4 def scope @scope end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
4 5 6 |
# File 'app/models/pageflow/entry_role_query.rb', line 4 def user @user end |
Instance Method Details
#with_role_at_least(role) ⇒ Object
11 12 13 14 15 16 |
# File 'app/models/pageflow/entry_role_query.rb', line 11 def with_role_at_least(role) scope .joins(memberships_for_entries_with_at_least_role(role)) .joins(memberships_for_account_of_entries_with_at_least_role(role)) .where(either_membership_is_present) end |