Skip to content

Commit 6033e8a

Browse files
committed
fix uninitialized ivar warnings
1 parent f5ae64d commit 6033e8a

File tree

1 file changed

+10
-0
lines changed
  • actionpack/lib/abstract_controller

1 file changed

+10
-0
lines changed

actionpack/lib/abstract_controller/base.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ def abstract!
3434
@abstract = true
3535
end
3636

37+
def inherited(klass) # :nodoc:
38+
# define the abstract ivar on subclasses so that we don't get
39+
# uninitialized ivar warnings
40+
unless klass.instance_variable_defined?(:@abstract)
41+
klass.instance_variable_set(:@abstract, false)
42+
end
43+
super
44+
end
45+
3746
# A list of all internal methods for a controller. This finds the first
3847
# abstract superclass of a controller, and gets a list of all public
3948
# instance methods on that abstract class. Public instance methods of
@@ -42,6 +51,7 @@ def abstract!
4251
# (ActionController::Metal and ActionController::Base are defined as abstract)
4352
def internal_methods
4453
controller = self
54+
4555
controller = controller.superclass until controller.abstract?
4656
controller.public_instance_methods(true)
4757
end

0 commit comments

Comments
 (0)