Skip to content

Latest commit

 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

‘application_config’ eases project configuring by introducing erb enabled yaml config file in RAILS_ROOT/config folder and provides handful methods accessing config values based on current rails environment. So, you can have separate sets of configuration properties for each rails environment you use.

gem “cleverua_application_config”, “~> 2.0”, :require => “application_config”

Then run:

rails generate application_config:install

During installation plugin will create default config in RAILS_ROOT/config/application_config.yml, it looks like the following (please note it’s okay to put ERB tags in there)

development: &defaults
  items_per_page: 25
  secure_with_basic_auth: false
  base_url: development.com
  erb_enabled_property: <%= "#{Rails.root}/something" %>
test:
  <<: *defaults
  base_url: test.com
production:
  <<: *defaults
  base_url: production.com

You then can access those values using ‘property’ method:

class FooController < ApplicationController
  def index
    @base_url = property(:base_url)
  end
end

This will set @base_url with value ‘development.com’ if you run that in development environment.

About

A simple Rails plugin that eases project configuring by introducing erb enabled yaml config file in RAILS_ROOT/config folder and provides handful methods accessing config values based on current rails environment

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages