Class: Ishapi::LeadsetsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/ishapi/leadsets_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#exception, #home, #long_term_token, #vote

Instance Method Details

#destroyObject



8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/ishapi/leadsets_controller.rb', line 8

def destroy
  authorize! :leadsets_destroy, ::Ishapi

  leadsets = Leadset.find( params[:leadset_ids] )
  @results = []
  leadsets.each do |leadset|
    @results.push leadset.discard
  end
  flash[:notice] = "Discard outcome: #{@results.inspect}."
  redirect_to action: 'index'
end

#indexObject



20
21
22
23
24
25
26
# File 'app/controllers/ishapi/leadsets_controller.rb', line 20

def index
  authorize! :leadsets_index, ::Ishapi
  out = Leadset.all
  render json: {
    items: out,
  }
end