Sha256: 19483cd1cb4c901c62fce352f2e86d0cda45fc2684a48dbcec8d00a3e1df9c83

Contents?: true

Size: 1003 Bytes

Versions: 3

Compression:

Stored size: 1003 Bytes

Contents

require_dependency "smithy/base_controller"

module Smithy
  class SettingsController < BaseController
    respond_to :html, :json

    def index
      @settings = Setting.all
      respond_with @settings
    end

    def show
      @setting = Setting.find(params[:id])
      respond_with @setting
    end

    def new
      @setting = Setting.new(params[:setting])
      respond_with @setting
    end

    def create
      @setting = Setting.new(params[:setting])
      @setting.save
      flash.notice = "Your setting was created" if @setting.persisted?
      respond_with @setting
    end

    def edit
      @setting = Setting.find(params[:id])
      respond_with @setting
    end

    def update
      @setting = Setting.find(params[:id])
      flash.notice = "Your setting was saved" if @setting.update_attributes(params[:setting])
      respond_with @setting
    end

    def destroy
      @setting = Setting.find(params[:id])
      @setting.destroy
      respond_with @setting
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
smithycms-0.0.3 app/controllers/smithy/settings_controller.rb
smithycms-0.0.2 app/controllers/smithy/settings_controller.rb
smithycms-0.0.1 app/controllers/smithy/settings_controller.rb