Class: MoneyWithDate::Hooks

Inherits:
Object
  • Object
show all
Defined in:
lib/money_with_date/hooks.rb

Class Method Summary collapse

Class Method Details

.initObject



5
6
7
8
9
10
11
# File 'lib/money_with_date/hooks.rb', line 5

def self.init
  ::ActiveSupport.on_load(:active_record) do
    require "money_with_date/active_record/monetizable"

    ::ActiveRecord::Base.prepend(::MoneyWithDate::ActiveRecord::Monetizable)
  end
end

.init?Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
# File 'lib/money_with_date/hooks.rb', line 13

def self.init?
  money_rails_version = ::Gem::Version.new(::MoneyRails::VERSION)

  money_rails_version >= ::Gem::Version.new(::MoneyWithDate::MINIMUM_MONEY_RAILS_VERSION) &&
    money_rails_version <= ::Gem::Version.new(::MoneyWithDate::MAXIMUM_MONEY_RAILS_VERSION)
end