Module: ActiveRecord::Tenanted::Relation
- Defined in:
- lib/active_record/tenanted/relation.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#initialize ⇒ Object
6 7 8 9 |
# File 'lib/active_record/tenanted/relation.rb', line 6 def initialize(...) super @tenant = @model.current_tenant if @model.tenanted? end |
#instantiate_records ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/active_record/tenanted/relation.rb', line 11 def instantiate_records(...) super.tap do |records| if @tenant records.each do |record| record.instance_variable_set(:@tenant, @tenant) end end end end |