Sha256: cd9eeacc5612797c3afd7276083e3635303e6cc5d338ed0f8058ad168dbacc33
Contents?: true
Size: 746 Bytes
Versions: 1
Compression:
Stored size: 746 Bytes
Contents
module BetterHelpers module Railties module RequestContext NAME = :better_helpers_request_controller def controller Thread.current[NAME] end def view_context controller.try(:view_context) end def method_missing method, *args, &block if view_context.respond_to?(method) # Sends helper methods to the view context and cache the used # methods to improve performance in the next calls self.class.send(:define_method, method) do |*args, &block| view_context.send(method, *args, &block) end self.send(method, *args, &block) else super(method, *args, &block) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
better_helpers-0.1.3 | lib/better_helpers/railties/request_context.rb |