Sha256: 3cc21a7afb7bc23be7aac2752167402b07bc011c915c72d2c33dc36c6ca4a258

Contents?: true

Size: 1.34 KB

Versions: 42

Compression:

Stored size: 1.34 KB

Contents

class ::IshManager::ServerhostsController < IshManager::ApplicationController

  # before_action :set_lists

  def create
    @serverhost = Wco::Serverhost.new params[:serverhost].permit!
    authorize! :create, @serverhost

    flag = @serverhost.save
    if flag
      flash[:notice] = 'Success.'
      redirect_to action: :index
    else
      flash[:alert] = "Cannot create serverhost: #{@serverhost.errors.full_messages.join(', ')}."
      render action: :index
    end
  end

  def edit
    @serverhost = Wco::Serverhost.find params[:id]
    authorize! :edit, @serverhost
  end

  def index
    authorize! :index, Wco::Serverhost
    @serverhosts = Wco::Serverhost.all
    @new_serverhost = Wco::Serverhost.new
  end

  def update
    @serverhost = Wco::Serverhost.find params[:id]
    authorize! :update, @serverhost
    flag = @serverhost.update_attributes params[:serverhost].permit!
    if flag
      flash[:notice] = "Success."
      redirect_to action: :index
    else
      flash[:alert] = "Cannot update serverhost: #{@serverhost.errors.full_messages.join(', ')}."
      render action: :edit
    end
  end



  ##
  ## private
  ##
  private

  # def set_lists
  #   super
  #   @new_serverhost = Wco::Serverhost.new
  #   puts! @new_serverhost.class, 'ze'
  #   puts! @new_serverhost, '@new_serverhost'
  #   @new_serverhost.name = 'some name'
  # end

end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
ish_manager-0.1.8.500 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.499 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.498 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.497 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.496 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.495 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.494 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.493 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.492 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.491 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.490 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.489 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.488 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.487 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.486 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.485 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.484 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.483 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.482 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.481 app/controllers/ish_manager/serverhosts_controller.rb