This project is archived and is in readonly mode.

#1246 ✓resolved
Gaius Centus Novus

[PATCH] "undefined method `NoMethodError' "

Reported by Gaius Centus Novus | October 21st, 2008 @ 11:05 PM | in 2.x

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....

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Pages