Displaying 1 result from an estimated 1 matches for "shareddefs".
2006 Apr 05
6
Howto add application-wide variables?
...have them
accessible to all my controllers?
I tried creating a plugin and having my controller require a specific
method from that plugin to access its variables but that didn''t work, so
I am left scratching my head.
eg from plugin ./vendor/plugins/myplugin/shared_defs.rb file
Module SharedDefs
def load_shared_defs
@var1 = something
@var2 = something_else
end
end
eg from controller
include SharedDefs
require :load_shared_defs
def index
@my_stuff = @var1
end
@var1 is not defined and so my guess is my scope is off or I''m not
accessing it correctly but I am...