Sha256: 032a19b92727c9ef1548a08bc04251e45216c7c8f9aa0bd690a89ab04f8a204a

Contents?: true

Size: 1.1 KB

Versions: 9

Compression:

Stored size: 1.1 KB

Contents

# rubocop:disable Naming/MethodName
# rubocop:disable Naming/UncommunicativeMethodParamName

module Arel
  module Attributes
    class Attribute
      module AttributeExtension
        # postgres only: https://www.postgresql.org/docs/10/ddl-schemas.html
        attr_accessor :schema_name
        attr_accessor :database
      end

      prepend AttributeExtension
    end
  end

  module Visitors
    class ToSql
      module AttributesAttributeExtension
        def visit_Arel_Attributes_Attribute(o, collector)
          collector << "#{quote_table_name(o.database)}." if o.database
          collector << "#{quote_table_name(o.schema_name)}." if o.schema_name

          super
        end
      end

      prepend AttributesAttributeExtension
    end

    class Dot
      module AttributesAttributeExtension
        def visit_Arel_Attributes_Attribute(o)
          super

          visit_edge o, 'schema_name'
          visit_edge o, 'database'
        end
      end

      prepend AttributesAttributeExtension
    end
  end
end

# rubocop:enable Naming/MethodName
# rubocop:enable Naming/UncommunicativeMethodParamName

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
arel_toolkit-0.4.9 lib/arel/extensions/attributes_attribute.rb
arel_toolkit-0.4.8 lib/arel/extensions/attributes_attribute.rb
arel_toolkit-0.4.7 lib/arel/extensions/attributes_attribute.rb
arel_toolkit-0.4.6 lib/arel/extensions/attributes_attribute.rb
arel_toolkit-0.4.5 lib/arel/extensions/attributes_attribute.rb
arel_toolkit-0.4.4 lib/arel/extensions/attributes_attribute.rb
arel_toolkit-0.4.3 lib/arel/extensions/attributes_attribute.rb
arel_toolkit-0.4.2 lib/arel/extensions/attributes_attribute.rb
arel_toolkit-0.4.1 lib/arel/extensions/attributes_attribute.rb