module MoneyRails
  module ActiveRecord
    module MigrationExtensions
      module Table
        def monetize(accessor, options={})
          [:amount, :currency].each do |attribute|
            column_present, _, *opts = OptionsExtractor.extract attribute, :no_table, accessor, options
            constraints = opts.pop
            column(*opts, **constraints) if column_present
          end
        end

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

module MoneyRails
  module ActiveRecord
    module MigrationExtensions
      module Table
        def monetize(accessor, options={})
          [:amount, :currency].each do |attribute|
            column_present, _, *opts = OptionsExtractor.extract attribute, :no_table, accessor, options
            if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3')
              constraints = opts.pop
              column(*opts, **constraints) if column_present
            else
              column(*opts) if column_present
            end
          end
        end

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

Support both 1.9.3 and 3.0.0
Support both 1.9.3 and 3.0.0

Added RVM GPG to download ruby 3.0.0 correctly in Travis
