Sha256: dbc9e087f5cb99fac5dedb9c7a14956cec88eab10cba8915024157a62ce3da6c

Contents?: true

Size: 1.46 KB

Versions: 6

Compression:

Stored size: 1.46 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])
    @content.update_attributes(params[:content])
    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

6 entries across 6 versions & 1 rubygems

Version Path
contentment-0.8.4 lib/generators/contentment/templates/contents_controller.rb
contentment-0.8.3 lib/generators/contentment/templates/contents_controller.rb
contentment-0.7.1 lib/generators/contentment/templates/contents_controller.rb
contentment-0.7.0 lib/generators/contentment/templates/contents_controller.rb
contentment-0.6.1 lib/generators/contentment/templates/contents_controller.rb
contentment-0.6.0 lib/generators/contentment/templates/contents_controller.rb