Sha256: 8aad0dff61ff791fdab553232af26c112400749335b7965d24c8b579e719d69e

Contents?: true

Size: 754 Bytes

Versions: 7

Compression:

Stored size: 754 Bytes

Contents

class Admin::ManagersController < Admin::BaseController
  def index
    @managers = scope.all
  end

  def new
    @manager = scope.new
    render 'edit'
  end

  def create
    @manager = scope.new(manager_params)
    redirect_or_edit(@manager, @manager.save)
  end

  def edit
    @manager = scope.find(params[:id])
  end

  def update
    @manager = scope.find(params[:id])
    redirect_or_edit(@manager, @manager.update(manager_params))
  end

  def destroy
    @manager = scope.find(params[:id])
    @manager.destroy if current_manager.id != @manager.id
    redirect_to [:admin, :managers], alert: 'Администратор удален'
  end

  private

  def scope
    Manager
  end

  def manager_params
    params[:manager].permit!
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
redde-0.3.6 app/controllers/admin/managers_controller.rb
redde-0.3.5 app/controllers/admin/managers_controller.rb
redde-0.3.4 app/controllers/admin/managers_controller.rb
redde-0.3.3 app/controllers/admin/managers_controller.rb
redde-0.3.2 app/controllers/admin/managers_controller.rb
redde-0.3.1 app/controllers/admin/managers_controller.rb
redde-0.3.0 app/controllers/admin/managers_controller.rb