Skip to content

Commit

Permalink
Added railsEnv to the default railsContext (#1065)
Browse files Browse the repository at this point in the history
Per #697
  • Loading branch information
justin808 authored Apr 22, 2018
1 parent 098b2d2 commit 838d8ac
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions docs/basics/upgrading-react-on-rails.md
Original file line number Diff line number Diff line change
@@ -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 [email protected]. 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:
Expand Down
1 change: 1 addition & 0 deletions lib/react_on_rails/react_on_rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions spec/dummy/spec/features/rails_context_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 838d8ac

Please sign in to comment.