Sha256: 0f6785adadfe1804437d6e6f9de7ec6f3d74f96ccffa57939007d1f70b01380d

Contents?: true

Size: 714 Bytes

Versions: 2

Compression:

Stored size: 714 Bytes

Contents

class Admin::SettingsController < Admin::BaseController
  load_and_authorize_resource param_method: :strong_params, class: 'Settings'

  def update
    if resource.update strong_params
      flash[:notice] = t 'flash.actions.update.notice'
      redirect_to action: :edit
    else
      flash[:error] = t 'flash.actions.update.alert'
      render action: :edit
    end
  end

  private

  def resource
    @resource ||= Settings.get
  end
  helper_method :resource

  def strong_params
    params.require(:settings).permit :email, :email_header_from, :per_page,
      :copyright, :index_meta_title, :index_meta_description, :company_name,
      :contact_email, :seo_google_analytics, :seo_yandex_metrika
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
adminos-1.0.0.pre.rc.5 lib/generators/templates/install/auto/app/controllers/admin/settings_controller.rb
adminos-1.0.0.pre.rc.4 lib/generators/templates/install/auto/app/controllers/admin/settings_controller.rb