Sha256: 3ea706ce6f9a078bc3bf51b8039dafa22ac00b88093b60e5dc7bcc119b174db7

Contents?: true

Size: 735 Bytes

Versions: 12

Compression:

Stored size: 735 Bytes

Contents

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

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

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

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

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

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

  private

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

Version data entries

12 entries across 7 versions & 1 rubygems

Version Path
redde-0.1.18 spec/dummy/app/controllers/admin/managers_controller.rb
redde-0.1.18 lib/generators/redde/layout/templates/controllers/managers_controller.rb
redde-0.1.17 lib/generators/redde/layout/templates/controllers/managers_controller.rb
redde-0.1.17 spec/dummy/app/controllers/admin/managers_controller.rb
redde-0.1.16 lib/generators/redde/layout/templates/controllers/managers_controller.rb
redde-0.1.16 spec/dummy/app/controllers/admin/managers_controller.rb
redde-0.1.15 lib/generators/redde/layout/templates/controllers/managers_controller.rb
redde-0.1.15 spec/dummy/app/controllers/admin/managers_controller.rb
redde-0.1.14 spec/dummy/app/controllers/admin/managers_controller.rb
redde-0.1.14 lib/generators/redde/layout/templates/controllers/managers_controller.rb
redde-0.1.13 lib/generators/redde/layout/templates/controllers/managers_controller.rb
redde-0.1.12 lib/generators/redde/layout/templates/controllers/managers_controller.rb