Module: Split::Cacheable::Helper::InstanceMethods

Defined in:
lib/split_cacheable/helper.rb

Instance Method Summary collapse

Instance Method Details

#current_tests_and_variationsObject

Controller helper method to get the current active tests + variations in the form of a partial cache key



17
18
19
# File 'lib/split_cacheable/helper.rb', line 17

def current_tests_and_variations
    Split::Cacheable::Adapter.new(self, self.action_name.to_sym).get_current_variations
end

#fragment_cache_key(key) ⇒ Object

Patch the default ActionController::Base action_cache key creation by prepending our current tests + variation key generated in the next method



12
13
14
# File 'lib/split_cacheable/helper.rb', line 12

def fragment_cache_key(key)
    super("#{current_tests_and_variations}/#{key}")
end