Sha256: c835c01bd4230ee253fbcd3d6cf60b2723876e641dded14a56aea8f512b3121f

Contents?: true

Size: 969 Bytes

Versions: 3

Compression:

Stored size: 969 Bytes

Contents

require_dependency "smithy/base_controller"

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

    def show
      @content = Smithy::Content.find(params[:id])
      respond_with @content
    end

    def new
      @content = Smithy::Content.new(params[:content])
      respond_with @content
    end

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

    def edit
      @content = Smithy::Content.find(params[:id])
      respond_with @content
    end

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

    def destroy
      @content = Smithy::Content.find(params[:id])
      @content.destroy
      respond_with @content
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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