Flowdock
method

add_user_provided_columns

Importance_0
v4.2.7 - Show latest stable - 0 notes - Class: ClassMethods
add_user_provided_columns(schema_columns) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/attributes.rb, line 112
      def add_user_provided_columns(schema_columns)
        existing_columns = schema_columns.map do |column|
          new_type = user_provided_columns[column.name]
          if new_type
            column.with_type(new_type)
          else
            column
          end
        end

        existing_column_names = existing_columns.map(&:name)
        new_columns = user_provided_columns.except(*existing_column_names).map do |(name, type)|
          connection.new_column(name, nil, type)
        end

        existing_columns + new_columns
      end
Register or log in to add new notes.