Skip to content

Commit

Permalink
Only load one instance of view helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
blaknite committed May 16, 2016
1 parent ecdd37f commit 4b3e343
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/blush.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ module Blush
module_function def config
@config ||= Blush::Configuration.new
end

module_function def helpers
@helpers ||= ActionView::Base.new
end
end

ActiveRecord::Base.send :extend, Blush::HasPresenter
2 changes: 1 addition & 1 deletion lib/blush/presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def initialize(object)
end

def helpers
@helpers ||= ActionView::Base.new
Blush.helpers
end

alias_method :h, :helpers
Expand Down

0 comments on commit 4b3e343

Please sign in to comment.