instance method prepare_column_options

Ruby on Rails 5.1.7

Since v4.0.13 Last seen in v5.1.7

Available in: v4.0.13 v4.1.16 v4.2.11.3 v5.0.7.2 v5.1.7

Signature

prepare_column_options(column)

This can be overridden on an Adapter level basis to support other extended datatypes (Example: Adding an array option in the PostgreSQL::ColumnDumper)

Parameters

column req
Source
# File activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb, line 24
      def prepare_column_options(column)
        spec = {}

        if limit = schema_limit(column)
          spec[:limit] = limit
        end

        if precision = schema_precision(column)
          spec[:precision] = precision
        end

        if scale = schema_scale(column)
          spec[:scale] = scale
        end

        default = schema_default(column) if column.has_default?
        spec[:default] = default unless default.nil?

        spec[:null] = "false" unless column.null

        if collation = schema_collation(column)
          spec[:collation] = collation
        end

        spec[:comment] = column.comment.inspect if column.comment.present?

        spec
      end

Defined in activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb line 24 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::ConnectionAdapters::ColumnDumper

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close