Sorry the title may not be very clear. Basically I have a wrapper for the Split gem called ABFeature in lib/ab_feature/ab_feature.rb
In my view I want to be able to call my helpers like this:
ABFeature.current_settings
But this is not working, here is the error I have:
undefined local variable or method `session' for ABFeature:Module
session is a method from ActionController and is seems I can’t access it…
Here is my code:
require 'split'
module ABFeature
class << self
include Split::Helper
def current_settings
...
end
end
end
class ActionController::Base
ActionController::Base.send :extend, ABFeature
end
Any idea?,
Greg
I’m not sure what the result should be but if you want the current_settings method available in the controller I think you can do
and then
I think you usually call helpers as instance methods. Then they should share the context with the controller.