Hi!
I’m trying to enhance a set of controllers which can set the level of
security.
Class MenuControllder < ApplicationController
include BasicTest
end
module BasicTest # in lib/basic_test.rb
@test = nil
def self.included controller
controller.before_filter(:basic_filter)
@test = controller.name
end
def basic_filter
raise @test
end
end
This doesn’t work at all. @test is nil by the time it calls
basic_filter.
If I use @@test then @@test results in the last controller that was
built by the server.
I need a new instance of BasicTest for each controller, and I need it to
not be accessed by other controllers that are inheriting BasicTest.
I might not be understanding Modules correctly, but I thought that this
is the types of things they did since multi inheritance is not
supported!
Any guidance on where to look to to accomplish this sort of thing would
be appreciated!