This gem stores settings within Yaml file or ActiveRecord::Store
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
In your application you can save value AdminSettings.{YOUR KEY}=value and after can read the value AdminSettings.{YOUR KEY}
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request