Sha256: b6fa478fbc35f45bdb2c3f185f4abf2a097f4d9a569988b7d40e5ec39213c5ff

Contents?: true

Size: 1.04 KB

Versions: 16

Compression:

Stored size: 1.04 KB

Contents

module Gaku
  class Admin::ContactTypesController < Admin::BaseController

    respond_to :js,   only: %i( new create edit update destroy index )

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

    def index
      @contact_types = ContactType.all
      set_count
      respond_with @contact_types
    end

    def new
      @contact_type = ContactType.new
      respond_with @contact_type
    end

    def create
      @contact_type = ContactType.new(contact_type_params)
      @contact_type.save
      set_count
      respond_with @contact_type
    end

    def edit
    end

    def update
      @contact_type.update(contact_type_params)
      respond_with @contact_type
    end

    def destroy
      @contact_type.destroy
      set_count
      respond_with @contact_type
    end

    private

    def set_contact_type
      @contact_type = ContactType.find(params[:id])
    end

    def contact_type_params
      params.require(:contact_type).permit(:name)
    end

    def set_count
      @count = ContactType.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/contact_types_controller.rb
gaku_admin-0.3.0.pre.4 app/controllers/gaku/admin/contact_types_controller.rb
gaku_admin-0.3.0.pre.3 app/controllers/gaku/admin/contact_types_controller.rb
gaku_admin-0.3.0.pre.2 app/controllers/gaku/admin/contact_types_controller.rb
gaku_admin-0.3.0.pre.1 app/controllers/gaku/admin/contact_types_controller.rb
gaku_admin-0.3.0.pre.0 app/controllers/gaku/admin/contact_types_controller.rb
gaku-0.2.4 admin/app/controllers/gaku/admin/contact_types_controller.rb
gaku_admin-0.2.4 app/controllers/gaku/admin/contact_types_controller.rb
gaku-0.2.3 admin/app/controllers/gaku/admin/contact_types_controller.rb
gaku_admin-0.2.3 app/controllers/gaku/admin/contact_types_controller.rb
gaku-0.2.2 admin/app/controllers/gaku/admin/contact_types_controller.rb
gaku_admin-0.2.2 app/controllers/gaku/admin/contact_types_controller.rb
gaku-0.2.1 admin/app/controllers/gaku/admin/contact_types_controller.rb
gaku_admin-0.2.1 app/controllers/gaku/admin/contact_types_controller.rb
gaku-0.2.0 admin/app/controllers/gaku/admin/contact_types_controller.rb
gaku_admin-0.2.0 app/controllers/gaku/admin/contact_types_controller.rb