diff --git a/CHANGELOG.md b/CHANGELOG.md index 198eb6ba7..f68956a3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ Changes since last non-beta release. - Errors raised are of type ReactOnRailsError, so you can see they came from React on Rails for debugging. - Removed ReactOnRails::Utils.server_bundle_file_name and ReactOnRails::Utils.bundle_file_name. - No longer logging the `railsContext` when server logging. +- Rails.env is provided in the default railsContext, as suggested in [issue #697](https://github.com/shakacode/react_on_rails/issues/697). +[PR 1018](https://github.com/shakacode/react_on_rails/pull/1065) by [justin808](https://github.com/justin808). #### Fixes - More exact version checking. We keep the react_on_rails gem and the react-on-rails node package at diff --git a/docs/basics/upgrading-react-on-rails.md b/docs/basics/upgrading-react-on-rails.md index ed39e65b2..f5484eba0 100644 --- a/docs/basics/upgrading-react-on-rails.md +++ b/docs/basics/upgrading-react-on-rails.md @@ -1,5 +1,11 @@ # Upgrading React on Rails +## Upgrading to version 11 +* 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 justin@shakacode.com. We have a custom node rendering solution in production for egghead.io. +* 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. +* 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. + + ## Upgrading to version 10 Pretty simple: diff --git a/lib/react_on_rails/react_on_rails_helper.rb b/lib/react_on_rails/react_on_rails_helper.rb index d4850c747..63eb6d35b 100644 --- a/lib/react_on_rails/react_on_rails_helper.rb +++ b/lib/react_on_rails/react_on_rails_helper.rb @@ -477,6 +477,7 @@ def initialize_redux_stores def rails_context(server_side: required("server_side")) @rails_context ||= begin result = { + railsEnv: Rails.env, inMailer: in_mailer?, # Locale settings i18nLocale: I18n.locale, diff --git a/spec/dummy/spec/features/rails_context_spec.rb b/spec/dummy/spec/features/rails_context_spec.rb index 86eeb33be..4d74a187a 100644 --- a/spec/dummy/spec/features/rails_context_spec.rb +++ b/spec/dummy/spec/features/rails_context_spec.rb @@ -22,6 +22,7 @@ port = Capybara.current_session.server.port host_port = "#{host}:#{port}" keys_to_vals = { + railsEnv: Rails.env, href: "http://#{host_port}/#{pathname}?ab=cd", location: "/#{pathname}?ab=cd", port: port,