Class: Sublease::Tenant
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Sublease::Tenant
- Defined in:
- app/models/sublease/tenant.rb
Class Method Summary collapse
-
.delete(id_or_array) ⇒ Object
Overrides standard ActiveRecord::Relation delete to call destroy instead ensuring all callbacks are fired.
-
.has_many_subleases(lodger, options = {}) ⇒ Object
Establishes an ActiveRecord Association with a forced destroy dependency.
Instance Method Summary collapse
-
#delete ⇒ Object
Overrides standard object delete to call destroy instead ensuring all callbacks are fired.
Class Method Details
.delete(id_or_array) ⇒ Object
Overrides standard ActiveRecord::Relation delete to call destroy instead ensuring all callbacks are fired.
12 13 14 |
# File 'app/models/sublease/tenant.rb', line 12 def delete(id_or_array) destroy(id_or_array) end |
.has_many_subleases(lodger, options = {}) ⇒ Object
Establishes an ActiveRecord Association with a forced destroy dependency. Takes the same options as ActiveRecord::Associations::ClassMethods has_many except it will override the dependent option with a dependent: :destroy in order to ensure the destruction of logders when the tenant is destroyed.
19 20 21 |
# File 'app/models/sublease/tenant.rb', line 19 def has_many_subleases(lodger, = {}) has_many lodger.to_sym, .delete(:dependent), dependent: :destroy end |
Instance Method Details
#delete ⇒ Object
Overrides standard object delete to call destroy instead ensuring all callbacks are fired.
26 27 28 |
# File 'app/models/sublease/tenant.rb', line 26 def delete destroy end |