Sha256: fdacb93a6c83b3e432f1323482b2c6181ce42c8b351dab5a63a9311970be3301
Contents?: true
Size: 995 Bytes
Versions: 4
Compression:
Stored size: 995 Bytes
Contents
# frozen_string_literal: true module Sublease class Tenant < ActiveRecord::Base self.abstract_class = true validates :subdomain, uniqueness: { scope: :domain } class << self # Overrides standard ActiveRecord::Relation delete to call destroy instead ensuring all callbacks are fired. def delete(id_or_array) destroy(id_or_array) end # 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. def has_many_subleases(lodger, options = {}) has_many lodger.to_sym, options.delete(:dependent), dependent: :destroy end end # Overrides standard object delete to call destroy instead ensuring all callbacks are fired. def delete destroy end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
sublease-0.2.3 | app/models/sublease/tenant.rb |
sublease-0.2.2 | app/models/sublease/tenant.rb |
sublease-0.2.1 | app/models/sublease/tenant.rb |
sublease-0.2.0 | app/models/sublease/tenant.rb |