This project is archived and is in readonly mode.
Rails assumes too much about the name of the "production" environment
Reported by Brian Ploetz | April 26th, 2011 @ 09:50 PM
For various reasons, we actually have several "production" Rails environments, and have a naming convention for them along the lines of "prod1", "prod2", etc. We've found that within the Rails source, there are a few checks for Rails.env.production?, which assumes the name of your production Rails environment is always just "production". For example:
https://github.com/rails/rails/blob/master/railties/lib/rails/appli...
https://github.com/rails/rails/blob/master/railties/lib/rails/appli...
https://github.com/rails/rails/blob/master/railties/lib/rails/test_...
This has tripped us up a couple of times. It would be nice if Rails provided a hook that allowed you to override the default name of the production environment, and also accounts for the fact that there could be more than one environment that are "production" like.
I understand that this is breaking a very well understood Rails convention, but as more and more SaaS apps are built with Rails (as ours is) this is becoming prohibitive.
Thoughts?
Comments and changes to this ticket
-
Pavel Lazureykis May 18th, 2011 @ 09:16 PM
Can you override this method?
config/initializers/00_production_environments.rb
module ActiveSupport
class StringInquirer < Stringdef production? %w(production prod1 prod2).include? self end
end end
-
Steven Soroka May 20th, 2011 @ 03:50 AM
- Tag changed from environments, production to environments, invalid, production
For such a special case, just override what production means like Pavel suggested.
-1
-
Brian Ploetz May 20th, 2011 @ 04:43 PM
Yes, of course we can just monkey patch ActiveSupport::StringInquirer.production? like that. That just seems a little brittle to me. My larger point was that as more and more SaaS apps get built with Rails, this may not be such a special case.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>