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