Class: ImpExp::Utils::RelationScoper
- Defined in:
- app/services/imp_exp/utils/relation_scoper.rb
Instance Attribute Summary collapse
-
#records ⇒ Object
readonly
Returns the value of attribute records.
-
#relation_class ⇒ Object
readonly
Returns the value of attribute relation_class.
-
#scoping_parent ⇒ Object
readonly
Returns the value of attribute scoping_parent.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(records, relation_class, scoping_parent) ⇒ RelationScoper
constructor
A new instance of RelationScoper.
Methods inherited from Service
Constructor Details
#initialize(records, relation_class, scoping_parent) ⇒ RelationScoper
Returns a new instance of RelationScoper.
8 9 10 11 12 13 |
# File 'app/services/imp_exp/utils/relation_scoper.rb', line 8 def initialize(records, relation_class, scoping_parent) super() @records = records @relation_class = relation_class @scoping_parent = scoping_parent end |
Instance Attribute Details
#records ⇒ Object (readonly)
Returns the value of attribute records.
6 7 8 |
# File 'app/services/imp_exp/utils/relation_scoper.rb', line 6 def records @records end |
#relation_class ⇒ Object (readonly)
Returns the value of attribute relation_class.
6 7 8 |
# File 'app/services/imp_exp/utils/relation_scoper.rb', line 6 def relation_class @relation_class end |
#scoping_parent ⇒ Object (readonly)
Returns the value of attribute scoping_parent.
6 7 8 |
# File 'app/services/imp_exp/utils/relation_scoper.rb', line 6 def scoping_parent @scoping_parent end |
Instance Method Details
#call ⇒ Object
15 16 17 |
# File 'app/services/imp_exp/utils/relation_scoper.rb', line 15 def call records.where(id: imp_exp_model.scoped(scoping_parent)) end |