-
-
Notifications
You must be signed in to change notification settings - Fork 631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Rails.env
to RailsContext
#697
Comments
@robwise Easy to add, either via a custom Rails Context enhancement (no PR required) or as a default for the RailsContext. See this example: https://github.com/shakacode/react_on_rails/blob/master/spec/dummy/config/initializers/react_on_rails.rb#L4 module RenderingExtension
# Return a Hash that contains custom values from the view context that will get passed to
# all calls to react_component and redux_store for rendering
def self.custom_context(view_context)
if view_context.controller.is_a?(ActionMailer::Base)
{}
else
{
somethingUseful: view_context.session[:something_useful]
}
end
end
end |
@justin808 yeah I'm already doing it the custom way, I'm saying I think it should be a default |
@robwise Maybe for features, we'll do if any of our Coaching Clients or regular clients want it? Otherwise, we can wait for the PR to come in. Or maybe if the issue gets at least 20 up votes. |
okay, and maybe just having this issue as a historical record will be good enough in case other people are using preboot and are not realizing that because the webpack isn't being recompiled, the variables may be stale and to watch out for that |
i'm gonna take it |
Fixed in #1065. |
Heroku Preboot is a feature on Heroku that allows for faster deploy times. When you promote your staging app to production, Preboot simply switches the production server to point at the staging app's container. This means it can deploy much faster since it doesn't have to rebuild anything.
However, this means that if you use the Define Plugin to provide the rails environment to your client code as a variable, that variable will erroneously still have a value of
Staging
instead ofProduction
. ProvidingRails.env
(which is accurate even in Preboot) in the default Rails context would be a nice enhancement.The text was updated successfully, but these errors were encountered: