README.md in rails-settings-cached-2.1.1 vs README.md in rails-settings-cached-2.2.0

- old
+ new

@@ -48,10 +48,11 @@ # cache_prefix { "v1" } field :host, default: "http://example.com" field :readonly_item, type: :integer, default: 100, readonly: true field :user_limits, type: :integer, default: 20 + field :exchange_rate, type: :float, default: 0.123 field :admin_emails, type: :array, default: %w[admin@rubyonrails.org] # Override array separator, default: /[\n,]/ split with \n or comma. field :tips, type: :array, separator: /[\n]+/ field :captcha_enable, type: :boolean, default: 1 field :notification_options, type: :hash, default: { @@ -210,22 +211,17 @@ ```rb module Admin class SettingsController < ApplicationController before_action :get_setting, only: [:edit, :update] - def show - end - def create setting_params.keys.each do |key| - next if key.to_s == "site_logo" Setting.send("#{key}=", setting_params[key].strip) unless setting_params[key].nil? end - redirect_to admin_settings_path(notice: "Setting was successfully updated.") + redirect_to settings_path, notice: "Setting was successfully updated." end - private def setting_params params.require(:setting).permit(:host, :user_limits, :admin_emails, :captcha_enable, :notification_options) end @@ -257,11 +253,12 @@ <div class="form-group"> <label class="control-label">Notification options</label> <%= f.text_area :notification_options, value: YAML.dump(Setting.notification_options), class: "form-control", style: "height: 180px;" %> <div class="form-text"> Use YAML format to config the SMTP_html - </details> + </div> + </div> <% end %> ``` ## Backward compatible to support 0.x scoped settings @@ -329,10 +326,9 @@ @user.foo # => ``` ## Use cases: -- [ruby-china/ruby-china](https://github.com/ruby-china/ruby-china) +- [ruby-china/homeland](https://github.com/ruby-china/homeland) - [thebluedoc/bluedoc](https://github.com/thebluedoc/bluedoc/blob/master/app/models/setting.rb) - [tootsuite/mastodon](https://github.com/tootsuite/mastodon) - [helpyio/helpy](https://github.com/helpyio/helpy) -