Sha256: 03a49d5bd22aa5ae432136a1d95087a92585da04617527b14ecaf27a787c5852
Contents?: true
Size: 791 Bytes
Versions: 10
Compression:
Stored size: 791 Bytes
Contents
module PandaPal class Organization < ActiveRecord::Base validates :key, uniqueness: { case_sensitive: false }, presence: true validates :secret, presence: true validates :name, uniqueness: { case_sensitive: false }, presence: true, format: { with: /\A[a-z0-9_]+\z/i } validates :canvas_account_id, presence: true validates :salesforce_id, presence: true, uniqueness: true after_create :create_schema after_commit :destroy_schema, on: :destroy before_validation on: [:update] do errors.add(:name, 'should not be changed after creation') if name_changed? end serialize :settings, Hash private def create_schema Apartment::Tenant.create name end def destroy_schema Apartment::Tenant.drop name end end end
Version data entries
10 entries across 10 versions & 1 rubygems