Module: NumericTypeColumn::ActiveRecord::TableDefinitionPatch

Defined in:
lib/numeric_type_column/active_record/table_definition_patch.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



9
10
11
12
# File 'lib/numeric_type_column/active_record/table_definition_patch.rb', line 9

def self.included(base)
  #puts "NumericTypeColumn::ActiveRecord::TableDefinitionPatch included to #{base.name}!"
  base.send :alias_method_chain, :column, :unsigned_and_comment
end

Instance Method Details

#column_with_unsigned_and_comment(name, type, options = {}) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/numeric_type_column/active_record/table_definition_patch.rb', line 14

def column_with_unsigned_and_comment(name, type, options = {})
  #puts "NumericTypeColumn::ActiveRecord::TableDefinitionPatch: column_with_unsigned_and_comment(name: #{name}, type: #{type}, options = {})..."
  ret_column = column_without_unsigned_and_comment(name, type, options)
  ret_column[name].unsigned = options[:unsigned]
  ret_column[name].comment = options[:comment]
  ret_column
end