Sha256: c095e2c82181e265b39a43a11be5dff0dd4a3ec46ca9d8d856e5c8f72127e183
Contents?: true
Size: 1.51 KB
Versions: 7
Compression:
Stored size: 1.51 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(section_params) 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(section_params) 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 private def section_params params.require(:section).permit(:parent_id, :name, :position) end end end
Version data entries
7 entries across 7 versions & 1 rubygems