Sha256: b832b99045ec9ca30fce61ad6b16ffdd6c57211ee44fd189ab90403f904d276a

Contents?: true

Size: 846 Bytes

Versions: 8

Compression:

Stored size: 846 Bytes

Contents

module Fae
  class OptionsController < ApplicationController

    before_filter :super_admin_only

    def edit
      @option = Option.first || Option.instance
      @option.build_logo if @option.logo.blank?
      @option.build_favicon if @option.favicon.blank?
    end

    # PATCH/PUT /options/1
    def update
      if @option.update(option_params)
        flash[:notice] = 'Option was successfully updated.'
        redirect_to :action => :edit
      else
        render :edit
      end
    end

    private

      # Only allow a trusted parameter "white list" through.
      def option_params
        params.require(:option).permit(:title, :time_zone, :colorway, :stage_url, :live_url, logo_attributes: [:id, :asset, :asset_cache, :attached_as, :alt], favicon_attributes: [:id, :asset, :asset_cache, :attached_as, :alt])
      end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fae-rails-1.4.1 app/controllers/fae/options_controller.rb
fae-rails-1.4.0 app/controllers/fae/options_controller.rb
fae-rails-1.3.1 app/controllers/fae/options_controller.rb
fae-rails-1.3.0 app/controllers/fae/options_controller.rb
fae-rails-1.2.5 app/controllers/fae/options_controller.rb
fae-rails-1.2.4 app/controllers/fae/options_controller.rb
fae-rails-1.2.3 app/controllers/fae/options_controller.rb
fae-rails-1.2.2 app/controllers/fae/options_controller.rb