Sha256: e0c6d388d8ff8b9199c3430ead1007641bd622eee1681f887576fbb6d6e150d7

Contents?: true

Size: 1.3 KB

Versions: 16

Compression:

Stored size: 1.3 KB

Contents

module Gaku
  class Admin::StudentReviewCategoriesController < Admin::BaseController

    respond_to :js

    before_action :set_student_review_category, only: %i( edit update destroy )

    def index
      @student_review_categories = StudentReviewCategory.all
      set_count
      respond_with @student_review_categories
    end

    def new
      @student_review_category = StudentReviewCategory.new
      respond_with @student_review_category
    end

    def create
      @student_review_category = StudentReviewCategory.create(student_review_category_params)
      set_count
      respond_with @student_review_category
    end

    def edit
    end

    def update
      @student_review_category.update(student_review_category_params)
      respond_with @student_review_category
    end

    def destroy
      @student_review_category.destroy!
      set_count
      respond_with @student_review_category
    end

    private

    def student_review_category_params
      params.require(:student_review_category).permit(student_review_category_attrs)
    end

    def student_review_category_attrs
      %i( name )
    end

    def set_student_review_category
      @student_review_category = StudentReviewCategory.find(params[:id])
    end

    def set_count
      @count = StudentReviewCategory.count
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
gaku_admin-0.3.0 app/controllers/gaku/admin/student_review_categories_controller.rb
gaku_admin-0.3.0.pre.4 app/controllers/gaku/admin/student_review_categories_controller.rb
gaku_admin-0.3.0.pre.3 app/controllers/gaku/admin/student_review_categories_controller.rb
gaku_admin-0.3.0.pre.2 app/controllers/gaku/admin/student_review_categories_controller.rb
gaku_admin-0.3.0.pre.1 app/controllers/gaku/admin/student_review_categories_controller.rb
gaku_admin-0.3.0.pre.0 app/controllers/gaku/admin/student_review_categories_controller.rb
gaku-0.2.4 admin/app/controllers/gaku/admin/student_review_categories_controller.rb
gaku_admin-0.2.4 app/controllers/gaku/admin/student_review_categories_controller.rb
gaku-0.2.3 admin/app/controllers/gaku/admin/student_review_categories_controller.rb
gaku_admin-0.2.3 app/controllers/gaku/admin/student_review_categories_controller.rb
gaku-0.2.2 admin/app/controllers/gaku/admin/student_review_categories_controller.rb
gaku_admin-0.2.2 app/controllers/gaku/admin/student_review_categories_controller.rb
gaku-0.2.1 admin/app/controllers/gaku/admin/student_review_categories_controller.rb
gaku_admin-0.2.1 app/controllers/gaku/admin/student_review_categories_controller.rb
gaku-0.2.0 admin/app/controllers/gaku/admin/student_review_categories_controller.rb
gaku_admin-0.2.0 app/controllers/gaku/admin/student_review_categories_controller.rb