I would expect the def case to work so long as it is not in the
private part of application_controller.rb. I would expect @img_types
= ... to also work. I would not expect just img_types = ... to work
as that is a local variable in the application_controller.rb object
and would quickly go out of scope when the class definition closes.
Michael
Hi --
I would expect the def case to work so long as it is not in the
private part of application_controller.rb. I would expect @img_types
= ... to also work. I would not expect just img_types = ... to work
as that is a local variable in the application_controller.rb object
and would quickly go out of scope when the class definition closes.
The first two cases actually work the other way around
A private
instance method of ApplicationController will be callable by the
subclasses (the other controllers). If you define an instance variable
out in the open:
class AC < AC::Base
@img_types = [a,b,c]
end
that won't be visible to the other classes (since they're different
objects and instance variables are per-object).
David