Skip to content

Commit

Permalink
Load Rails helpers on ActionView loading.
Browse files Browse the repository at this point in the history
In some specific cases, ActionView might be loaded without ActionController.
Fixes #38
  • Loading branch information
renchap committed Sep 12, 2017
1 parent a2b79a7 commit d7da36f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Fixed
- The whole `lodash` library was imported, resulting in a big bundle. Specific `lodash` functions`imports` are now used.
- Helpers are now loaded on `ActionView` loading (fixes #38)

## [0.3.1] - 2017-05-30

Expand Down
4 changes: 4 additions & 0 deletions lib/webpacker/react/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ class Engine < ::Rails::Engine
ActiveSupport.on_load(:action_controller) do
ActionController::Base.helper ::Webpacker::React::Helpers
end

ActiveSupport.on_load :action_view do
include ::Webpacker::React::Helpers
end
end

initializer :webpacker_react_renderer, group: :all do |_app|
Expand Down

0 comments on commit d7da36f

Please sign in to comment.