Get rid of constant name usage for stack trace help in favor of overriding #inspect and .name.

This commit is contained in:
Yehuda Katz 2009-10-09 00:53:48 -10:00
parent 69aa5e8a86
commit ee37ff46e9

@ -236,15 +236,15 @@ def self.for_controller(controller)
# they are in AC.
if controller.class.respond_to?(:_helper_serial)
klass = @views[controller.class._helper_serial] ||= Class.new(self) do
name = controller.class.name.gsub(/::/, '__')
const_set(:CONTROLLER_CLASS, controller.class)
Subclasses.class_eval do
if method(:const_defined?).arity == 1
remove_const(name) if const_defined?(name) # Ruby 1.8.x
else
remove_const(name) if const_defined?(name, false) # Ruby 1.9.x
end
const_set(name, self)
# Try to make stack traces clearer
def self.name
"ActionView for #{CONTROLLER_CLASS}"
end
def inspect
"#<#{self.class.name}>"
end
if controller.respond_to?(:_helpers)