module Enumerize::ActiveRecordSupport
Public Instance Methods
enumerize(name, options={})
click to toggle source
Calls superclass method
# File lib/enumerize/activerecord.rb, line 3 def enumerize(name, options={}) super _enumerize_module.dependent_eval do if self < ::ActiveRecord::Base include InstanceMethods # Since Rails use `allocate` method on models and initializes them with `init_with` method. # This way `initialize` method is not being called, but `after_initialize` callback always gets triggered. after_initialize :_set_default_value_for_enumerized_attributes # https://github.com/brainspec/enumerize/issues/111 require 'enumerize/hooks/uniqueness' end end end