Sha256: 400f35b4776ae9c039d3d57e16e909ba724ec31ee6e767a0cffefeb6214008d4
Contents?: true
Size: 547 Bytes
Versions: 4
Compression:
Stored size: 547 Bytes
Contents
module PandaPal module OrganizationConcerns module MultiDatabaseSharding extend ActiveSupport::Concern included do if column_names.include?('shard') validates :shard, format: { with: /\A[a-z0-9_]+\z/i }, allow_blank: true before_validation on: [:update] do errors.add(:shard, 'should not be changed after creation') if shard_changed? end end end def tenant_name return "#{shard}:#{name}" if shard.present? super end end end end
Version data entries
4 entries across 4 versions & 1 rubygems