Where/How to code Constants in Rails 3 Application [duplicate]

You don’t need to use constants in Rails 3.It is better to use the Rails::Application singleton.

In your application.rb you can define your constante like:

module Yourapp
  class Application < Rails::Application

    config.access_request.review = 'xxx'
  end
end

After in your code you can call

Yourapp::Application.config.access_request.review

After if you change value in each environment, You just define the config.xx in your config/environments/production.rb or other environment.

Leave a Comment

tech