method
define_non_cyclic_method
v3.2.8 -
Show latest stable
- Class:
ActiveRecord::AutosaveAssociation::ClassMethods
define_non_cyclic_method(name, reflection, &block)private
No documentation available.
# File activerecord/lib/active_record/autosave_association.rb, line 154
def define_non_cyclic_method(name, reflection, &block)
define_method(name) do |*args|
result = true; @_already_called ||= {}
# Loop prevention for validation of associations
unless @_already_called[[name, reflection.name]]
begin
@_already_called[[name, reflection.name]]=true
result = instance_eval(&block)
ensure
@_already_called[[name, reflection.name]]=false
end
end
result
end
end