Sha256: e0af99a5728118eccfa89e842302f7dab36998c450fafdc2fce15c695c9472ae

Contents?: true

Size: 386 Bytes

Versions: 2

Compression:

Stored size: 386 Bytes

Contents

module Landable
  module TableName
    extend ActiveSupport::Concern

    included do
      schema = "#{Landable.configuration.database_schema_prefix}landable"
      suffix = parent.name.demodulize.downcase

      schema += "_#{suffix}" unless suffix == 'landable'
      model_name = self.model_name.element.pluralize
      self.table_name = "#{schema}.#{model_name}"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
landable-1.14.0 app/models/concerns/landable/table_name.rb
landable-1.13.2 app/models/concerns/landable/table_name.rb