Merge pull request #592 from tiegz/before_filter_name

Give before_filter a name
This commit is contained in:
Steve Klabnik 2014-06-03 04:01:54 +03:00
commit 05a5dff7fc
2 changed files with 6 additions and 4 deletions

View File

@ -33,10 +33,7 @@ module Draper
extend Draper::HelperSupport
extend Draper::DecoratesAssigned
before_filter do |controller|
Draper::ViewContext.clear!
Draper::ViewContext.controller = controller
end
before_filter :activate_draper
end
end

View File

@ -10,6 +10,11 @@ module Draper
end
end
# Set the current controller
def activate_draper
Draper::ViewContext.controller = self
end
# Returns the current controller.
def self.controller
RequestStore.store[:current_controller]