Sha256: 2736a3a9ffbb95c8e1f5816f889613278597ee9530f556f73a039078458531e2

Contents?: true

Size: 666 Bytes

Versions: 1

Compression:

Stored size: 666 Bytes

Contents

module Traits
  class Model
    module Querying
      def primary_key_name
        model_class.primary_key.to_sym
      end

      def arel
        model_class.arel_table
      end

      def connection
        model_class.connection
      end

      def table_name
        model_class.table_name
      end

      def quoted_table_name
        connection.quote_table_name(model_class.table_name)
      end

      def to_hash
        super.merge!(
          table_name:        table_name,
          quoted_table_name: quoted_table_name,
          polymorphic_type:  polymorphic_type,
          primary_key_name:  primary_key_name
        )
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord-traits-1.0.0 lib/traits/concerns/model/querying.rb