Sha256: 16a553b9894bef5d173f25be2302f5872771b7ba9e2e4008b6b2dc073c9418dc

Contents?: true

Size: 1.52 KB

Versions: 11

Compression:

Stored size: 1.52 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 show
    @serverhost = Wco::Serverhost.find params[:id]
    authorize! :show, @serverhost
  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'

    @wco_leadsets_list = [[nil,nil]] + Wco::Leadset.all.map { |i| [ i.name, i.id ] }
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ish_manager-0.1.8.513 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.512 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.511 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.510 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.509 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.508 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.507 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.506 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.505 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.504 app/controllers/ish_manager/serverhosts_controller.rb
ish_manager-0.1.8.503 app/controllers/ish_manager/serverhosts_controller.rb