Skip to content

Commit ec31ba4

Browse files
committed
Added railsEnv to the default railsContext
Per #697
1 parent 4682d4f commit ec31ba4

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ Changes since last non-beta release.
2020
- Removed ReactOnRails::Utils.server_bundle_file_name and ReactOnRails::Utils.bundle_file_name.
2121
- No longer logging the `railsContext` when server logging.
2222

23+
24+
- Rails.env is provided in the default railsContext, as suggested in [issue #697](https://github.com/shakacode/react_on_rails/issues/697).
25+
[PR 1018](https://github.com/shakacode/react_on_rails/pull/1065) by [justin808](https://github.com/justin808).
26+
2327
### [10.1.4] - 2018-04-11
2428

2529
#### Fixed

docs/basics/upgrading-react-on-rails.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Upgrading React on Rails
22

3+
## Upgrading to version 11
4+
* Remove `server_render_method` from config/initializers/react_on_rails.rb. Alternate server rendering methods are part of React on Rails Pro. If you want to use a custom renderer, contact [email protected]. We have a custom node rendering solution in production for egghead.io.
5+
* Remove your usage of ENV["TRACE_REACT_ON_RAILS"] usage. You can get all tracing with either specifying trace at your component or in your config/initializers/react_on_rails.rb file.
6+
* ReactOnRails::Utils.server_bundle_file_name and ReactOnRails::Utils.bundle_file_name were removed. React on Rails Pro contains upgrades to enable component and other types caching with React on Rails.
7+
8+
39
## Upgrading to version 10
410

511
Pretty simple:

lib/react_on_rails/react_on_rails_helper.rb

+1
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ def initialize_redux_stores
477477
def rails_context(server_side: required("server_side"))
478478
@rails_context ||= begin
479479
result = {
480+
railsEnv: Rails.env,
480481
inMailer: in_mailer?,
481482
# Locale settings
482483
i18nLocale: I18n.locale,

spec/dummy/spec/features/rails_context_spec.rb

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
port = Capybara.current_session.server.port
2323
host_port = "#{host}:#{port}"
2424
keys_to_vals = {
25+
railsEnv: Rails.env,
2526
href: "http://#{host_port}/#{pathname}?ab=cd",
2627
location: "/#{pathname}?ab=cd",
2728
port: port,

0 commit comments

Comments
 (0)