Class: IshManager::ApplianceTmplsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/ish_manager/appliance_tmpls_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#basic_auth, #home, #tinymce

Instance Method Details

#createObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/ish_manager/appliance_tmpls_controller.rb', line 6

def create
  @appliance_tmpl = Wco::ApplianceTmpl.new params[:appliance].permit!
  authorize! :create, @appliance_tmpl

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

#indexObject



20
21
22
23
# File 'app/controllers/ish_manager/appliance_tmpls_controller.rb', line 20

def index
  authorize! :index, Wco::ApplianceTmpl
  @appliance_tmpls = Wco::ApplianceTmpl.all
end