Sha256: 18f42a1739ddf60b1fb8d5d95347c8bf2a09003cb6e61cd77249a7085eedd288
Contents?: true
Size: 728 Bytes
Versions: 10
Compression:
Stored size: 728 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 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