Flowdock
method

define_non_cyclic_method

Importance_0
define_non_cyclic_method(name, &block) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/autosave_association.rb, line 172
        def define_non_cyclic_method(name, &block)
          return if method_defined?(name, false)

          define_method(name) do |*args|
            result = true; @_already_called ||= {}
            # Loop prevention for validation of associations
            unless @_already_called[name]
              begin
                @_already_called[name] = true
                result = instance_eval(&block)
              ensure
                @_already_called[name] = false
              end
            end

            result
          end
        end
Register or log in to add new notes.