Sha256: 7526da2c40eb1871d6a6ef21293583e7674e50c8af71f23f0889fcd36d24912b

Contents?: true

Size: 1.41 KB

Versions: 7

Compression:

Stored size: 1.41 KB

Contents

require_dependency "how_to/application_controller"

module HowTo
  class SectionsController < ApplicationController
    before_filter :authorise_how_to_manage!

    def index
      @sections = Section.all

      respond_to do |format|
        format.html # index.html.erb
      end
    end

    def show
      @section = Section.find(params[:id])

      respond_to do |format|
        format.html # show.html.erb
      end
    end

    def new
      @section = Section.new
      respond_to do |format|
        format.html # new.html.erb
      end
    end

    def edit
      @section = Section.find(params[:id])
    end

    def create
      @section = Section.new(params[:section])

      respond_to do |format|
        if @section.save
          format.html { redirect_to @section, notice: 'Section was successfully created.' }
        else
          format.html { render action: "new" }
        end
      end
    end

    def update
      @section = Section.find(params[:id])

      respond_to do |format|
        if @section.update_attributes(params[:section])
          format.html { redirect_to @section, notice: 'Section was successfully updated.' }
        else
          format.html { render action: "edit" }
        end
      end
    end

    def destroy
      @section = Section.find(params[:id])
      @section.destroy

      respond_to do |format|
        format.html { redirect_to sections_url }
      end
    end


  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
how_to-0.0.7 app/controllers/how_to/sections_controller.rb
how_to-0.0.6 app/controllers/how_to/sections_controller.rb
how_to-0.0.5 app/controllers/how_to/sections_controller.rb
how_to-0.0.4 app/controllers/how_to/sections_controller.rb
how_to-0.0.3 app/controllers/how_to/sections_controller.rb
how_to-0.0.2 app/controllers/how_to/sections_controller.rb
how_to-0.0.1 app/controllers/how_to/sections_controller.rb