No commit activity in last 3 years
No release in over 3 years
This gem helps to add global configuration to your Rails 4 app.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 4.0.0
 Project Readme

Global Configuration

Global Configuration gem helps to add global configuration to your Rails 4 app.

Installation

Add this line to your application's Gemfile:

gem 'global_configuration'

And then execute:

$ bundle

Or install it yourself as:

$ gem install global_configuration

Finally, generate needed migrations:

$ rake global_configuration_engine:install:migrations

And migrate your database:

$ rake db:migrate

Usage

Write configuration

GlobalConfiguration::Configuration.write(:test, 'Test string') # => true
GlobalConfiguration::Configuration.write('test', 30.56) # => true

GlobalConfiguration::Configuration.write(nil, 'Test string') # => false
GlobalConfiguration::Configuration.write!(nil, 'Test string') # => ArgumentError 

GlobalConfiguration::Configuration[:test] = 364

Read configuration

GlobalConfiguration::Configuration.read(:test)
GlobalConfiguration::Configuration[:test]

Delete configuration

GlobalConfiguration::Configuration.delete(:test)
GlobalConfiguration::Configuration.write(:test, nil)
GlobalConfiguration::Configuration[:test] = nil

Testing

$ rspec