Class: Thredded::MessageboardPolicy::Scope

Inherits:
Object
  • Object
show all
Defined in:
app/policies/thredded/messageboard_policy.rb

Overview

The scope of readable messageboards

Instance Method Summary collapse

Constructor Details

#initialize(user, scope) ⇒ Scope

Returns a new instance of Scope.

Parameters:



9
10
11
12
# File 'app/policies/thredded/messageboard_policy.rb', line 9

def initialize(user, scope)
  @user = user
  @scope = scope
end

Instance Method Details

#resolveActiveRecord::Relation<Thredded::Messageboards>

Returns:

  • (ActiveRecord::Relation<Thredded::Messageboards>)


15
16
17
# File 'app/policies/thredded/messageboard_policy.rb', line 15

def resolve
  @scope.merge(@user.thredded_can_read_messageboards)
end