Activeadmin Settings Cached

Gem Version

Provides a nice UI interface for rails-settings-cached gem in Active Admin.

Installation

Add this line to your application's Gemfile:

gem 'activeadmin_settings_cached'

And then execute:

$ bundle

Create your settings model:

$ rails g settings Settings
$ bundle exec rake db:migrate

Add a route in config/routes.rb

ActiveAdmin.routes(self)
mount ActiveadminSettingsCached::Engine => '/admin'

And configure your default values in your Settings model:

class Settings < RailsSettings::CachedSettings
   defaults[:my_awesome_settings] = 'This is my settings'
end

In your application's admin interface, there will now be a new page with this setting

Localization

You can localize settings keys in local file

en:
  settings:
    attributes:
      my_awesome_settings:
        name: 'My Awesome Lolaized Setting'

Model name

By default the name of the mode is Settings. If you want to use a different name for the model, you can specify your that in config/initializers/active_admin_settings_cached.rb:

ActiveadminSettingsCached.configure do |config|
  config.model_name = 'AdvancedSetting'
end

Display options

If you need define display options for settings fields, eg textarea, url or :timestamp and etc., you can set display option in initializer.

ActiveadminSettingsCached.configure do |config|
  condig.display = {
    my_awesome_setting_name: :text,
    my_awesome_setting_name_2: :timestamp,
    my_awesome_setting_name_3: :select
  }
end

Available options see here