Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

[PATCH] "undefined method `NoMethodError' "

#1246

Create an ActiveRecord model, say Blog, and define a private setter on one of its attributes. Call the setter. AttributeMethods will raise an NoMethodError.

Ironically, it's because AttributeMethods is trying to raise a NoMethodError without calling .new on the class:

def method_missing(method_id, *args, &block)
  method_name = method_id.to_s

  if self.class.private_method_defined?(method_name)
    raise NoMethodError("Attempt to call private method", method_name, args)
  end

  ...

The fix is to add .new between NoMethodError and ("Attempt....

Reported by Gaius Centus Novus · October 21st, 2008 @ 11:05 PM

State: resolved
Milestone: 2.x
Assigned to: nobody
Importance: none