Class: PassesController

Inherits:
ArtfullyOseController show all
Defined in:
app/controllers/passes_controller.rb

Instance Method Summary collapse

Instance Method Details

#bulk_updateObject



10
11
12
13
14
15
# File 'app/controllers/passes_controller.rb', line 10

def bulk_update
  @person = Person.find(params[:person_id])
  authorize! :edit, @person
  extend_passes(params)
  redirect_to person_passes_path(@person)
end

#indexObject



5
6
7
8
# File 'app/controllers/passes_controller.rb', line 5

def index
  @passes = @person.passes.includes(:pass_type, :tickets).not_expired
  @expired_passes = @person.passes.includes(:pass_type).expired
end

#reminderObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/controllers/passes_controller.rb', line 17

def reminder
  @person = Person.find(params[:person_id])
  authorize! :edit, @person
  @pass_ids = params['pass_ids']

  if @pass_ids.blank?
    flash[:error] = "Please select at least one pass to send a reminder for."
  else
    @passes = Pass.where(:organization_id => @person.organization.id)
                  .where(:id => params[:pass_ids])
                  .all
    @person.delay.send_pass_summary_email(@passes)
    flash[:notice] = "We'll get those pass codes out to #{@person} right away!"
  end

  redirect_to person_passes_path(@person)
end