Flowdock
define_non_cyclic_method(name, reflection, &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 146
      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
Register or log in to add new notes.