Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 /app/assets/javascripts/debug.js 下的 rails 3 应用程序中定义了一些调试 javascript 函数。是否有任何简单的方法来确保这些仅包含在开发环境中,而不是测试或生产环境中?
测试以下任何一项:
ENV['RAILS_ENV']
RAILS_ENV
Rails.env
Rails.env.development?