/preferences_boxer

Store your peferences.

Primary LanguageRubyMIT LicenseMIT

PreferencesBoxer

This gem stores settings within Yaml file or ActiveRecord::Store

Installation

Add this line to your application's Gemfile:

gem 'preferences_boxer'

If you want Yaml store, create yaml file with settings: --- site_name: test1 owner_name: test2

Then add to config/initializers/preferences.rb : AdminSettings = PreferencesBoxer.configure do |config| PreferencesBoxer.store_type='yaml' config.path = Rails.root.join('config/settings.yml') end

else If you want to use AR::Store add AdminSettings = PreferencesBoxer.configure do |config| config.store_type = 'db' config.source_record = Person.find(1) config.source_field = :url config.init_values = {site_name: 'test1', owner_name: 'test2', admin_login: 'root', admin_password: '$2a$10$sd66SJyZxCVjavZ2Cz3s1OsuoFawJ4Pyu/GPc98mj8k0ahSp.feQW'} end

Then assign AdminSettings=PreferencesBoxer::Settings

Usage

In your application you can save value AdminSettings.{YOUR KEY}=value and after can read the value AdminSettings.{YOUR KEY}

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request