Sha256: b09ad0e69e595790f73204ab7325b0d69b9133b2ecfd113cfaec77a44360ca66

Contents?: true

Size: 743 Bytes

Versions: 10

Compression:

Stored size: 743 Bytes

Contents

module MoneyRails
  module ActiveRecord
    module MigrationExtensions
      module SchemaStatements
        def add_money(table_name, accessor, options={})
          [:amount, :currency].each do |attribute|
            column_present, *opts = OptionsExtractor.extract attribute, table_name, accessor, options
            add_column *opts if column_present
          end
        end

        def remove_money(table_name, accessor, options={})
          [:amount, :currency].each do |attribute|
            column_present, table_name, column_name, _, _ =  OptionsExtractor.extract attribute, table_name, accessor, options
            remove_column table_name, column_name if column_present
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
money-rails-1.3.0 lib/money-rails/active_record/migration_extensions/schema_statements.rb
money-rails-1.2.0 lib/money-rails/active_record/migration_extensions/schema_statements.rb
money-rails-1.1.0 lib/money-rails/active_record/migration_extensions/schema_statements.rb
money-rails-1.0.0 lib/money-rails/active_record/migration_extensions/schema_statements.rb
money-rails-0.12.0 lib/money-rails/active_record/migration_extensions/schema_statements.rb
money-rails-0.11.0 lib/money-rails/active_record/migration_extensions/schema_statements.rb
money-rails-0.10.0 lib/money-rails/active_record/migration_extensions/schema_statements.rb
money-rails-0.9.0 lib/money-rails/active_record/migration_extensions/schema_statements.rb
money-rails-0.8.1 lib/money-rails/active_record/migration_extensions/schema_statements.rb
money-rails-0.7.1 lib/money-rails/active_record/migration_extensions/schema_statements.rb