Sha256: a6636fa689f1094453109bf7aefde4ad0986f06a139a368c9d49312d4e3c063e

Contents?: true

Size: 1.41 KB

Versions: 7

Compression:

Stored size: 1.41 KB

Contents

class ContentsController < ApplicationController
	
  def index
    @contents = Content.order("tipe ASC, position ASC")
    respond_to do |format|
      format.html 
    end
  end

  def show
    @content = Content.find(params[:id])
    respond_to do |format|
      format.html
    end
  end

  def new
    @content = Content.new
    respond_to do |format|
      format.html
    end
  end

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

  def create
    @content = Content.new(params[:content])
    respond_to do |format|
      if @content.save
        format.html { redirect_to edit_content_path(@content.id), :notice =>  'Content was successfully created.'  }
      else
        format.html { redirect_to new_content_path, :notice => "There was a problem creating that content" + @content.errors.full_messages.join(', ') }
      end
    end
  end

  def update
    @content = Content.find(params[:id])
    respond_to do |format|
      if @content.save
        format.html { redirect_to edit_content_path(@content.id), :notice =>  'Content was successfully updated.'  }
      else
        format.html { redirect_to new_content_path, :notice => "There was a problem updating that content" + @content.errors.full_messages.join(', ') }
      end
    end
  end

  def destroy
    @content = Content.find(params[:id])
    @content.destroy
    respond_to do |format|
      format.html { redirect_to(contents_url) }
    end
  end
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
contentment-0.5.1 lib/generators/contentment/templates/contents_controller.rb
contentment-0.5.0 lib/generators/contentment/templates/contents_controller.rb
contentment-0.4.0 lib/generators/contentment/templates/contents_controller.rb
contentment-0.3.2 lib/generators/contentment/templates/contents_controller.rb
contentment-0.3.1 lib/generators/contentment/templates/contents_controller.rb
contentment-0.3.0 lib/generators/contentment/templates/contents_controller.rb
contentment-0.1.0 lib/generators/contentment/templates/contents_controller.rb