This project is archived and is in readonly mode.
[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
-
Frederick Cheung December 14th, 2008 @ 06:23 PM
- State changed from new to resolved
Was fixed in 5c97d4ff29cfd944da751f01177a3024626d57bb
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>