Sha256: 85ecc69365364d924c613a53a9055df216bc7921eb2550d2bce1f29e57b490e9

Contents?: true

Size: 387 Bytes

Versions: 8

Compression:

Stored size: 387 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

8 entries across 8 versions & 1 rubygems

Version Path
landable-1.13.1 app/models/concerns/landable/table_name.rb
landable-1.12.3 app/models/concerns/landable/table_name.rb
landable-1.12.2 app/models/concerns/landable/table_name.rb
landable-1.12.1 app/models/concerns/landable/table_name.rb
landable-1.11.1 app/models/concerns/landable/table_name.rb
landable-1.11.0 app/models/concerns/landable/table_name.rb
landable-1.10.0.rc2 app/models/concerns/landable/table_name.rb
landable-1.10.0.rc1 app/models/concerns/landable/table_name.rb