Module: Cell::Tenant
- Defined in:
- lib/cell/tenant.rb
Defined Under Namespace
Modules: ClassMethods
Class Attribute Summary collapse
-
.cls ⇒ Object
Returns the value of attribute cls.
Class Method Summary collapse
Instance Method Summary collapse
Class Attribute Details
.cls ⇒ Object
Returns the value of attribute cls.
8 9 10 |
# File 'lib/cell/tenant.rb', line 8 def cls @cls end |
Class Method Details
.included(model) ⇒ Object
38 39 40 |
# File 'lib/cell/tenant.rb', line 38 def self.included(model) fail "Use `prepend` instead of `include`." end |
.prepended(model) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/cell/tenant.rb', line 42 def self.prepended(model) model.extend(ClassMethods) if ::Cell.const_defined?(:Model) ::Cell.send(:remove_const, :Model) end ::Cell.const_set(:Model, model) model.prepend(::Cell::Schema) model.prepend(::Cell::Context) model.prepend(::Cell::UrlOptions) end |
Instance Method Details
#cell_id ⇒ Object
25 26 27 |
# File 'lib/cell/tenant.rb', line 25 def cell_id send(self.class.cell_id_column) end |
#cell_id_change_set ⇒ Object
33 34 35 36 |
# File 'lib/cell/tenant.rb', line 33 def cell_id_change_set fail "cell_id was not changed" unless cell_id_changed? previous_changes[self.class.cell_id_column] end |
#cell_id_changed? ⇒ Boolean
29 30 31 |
# File 'lib/cell/tenant.rb', line 29 def cell_id_changed? !! previous_changes[self.class.cell_id_column] end |