Skip to content

Commit

Permalink
initialize ivars so we don't have to constantly check them
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Jul 2, 2013
1 parent 09b31f0 commit 17af1ab
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion activerecord/lib/active_record/attribute_methods.rb
Expand Up @@ -8,6 +8,7 @@ module AttributeMethods
include ActiveModel::AttributeMethods include ActiveModel::AttributeMethods


included do included do
@attribute_methods_generated = false
include Read include Read
include Write include Write
include BeforeTypeCast include BeforeTypeCast
Expand All @@ -26,6 +27,7 @@ def inherited(child_class) #:nodoc:


def initialize_generated_modules # :nodoc: def initialize_generated_modules # :nodoc:
@generated_attribute_methods = Module.new { extend Mutex_m } @generated_attribute_methods = Module.new { extend Mutex_m }
@attribute_methods_generated = false
include @generated_attribute_methods include @generated_attribute_methods
end end


Expand All @@ -43,7 +45,7 @@ def define_attribute_methods # :nodoc:
end end


def attribute_methods_generated? # :nodoc: def attribute_methods_generated? # :nodoc:
@attribute_methods_generated ||= false @attribute_methods_generated
end end


def undefine_attribute_methods # :nodoc: def undefine_attribute_methods # :nodoc:
Expand Down

0 comments on commit 17af1ab

Please sign in to comment.