Class: Pageflow::EntryRoleQuery::Scope

Inherits:
Scope
  • Object
show all
Defined in:
app/models/pageflow/entry_role_query.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, scope, table_alias_prefix: nil) ⇒ Scope

Returns a new instance of Scope.



6
7
8
9
10
# File 'app/models/pageflow/entry_role_query.rb', line 6

def initialize(user, scope, table_alias_prefix: nil)
  @user = user
  @scope = scope
  @table_alias_prefix = table_alias_prefix
end

Instance Attribute Details

#scopeObject (readonly)

Returns the value of attribute scope.



4
5
6
# File 'app/models/pageflow/entry_role_query.rb', line 4

def scope
  @scope
end

#userObject (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_account_role_at_least(role) ⇒ Object



19
20
21
22
23
# File 'app/models/pageflow/entry_role_query.rb', line 19

def (role)
  scope
    .joins()
    .where((role))
end

#with_role_at_least(role) ⇒ Object



12
13
14
15
16
17
# File 'app/models/pageflow/entry_role_query.rb', line 12

def with_role_at_least(role)
  scope
    .joins()
    .joins(memberships_for_entries)
    .where(either_membership_has_at_least_role(role))
end