Class: Effective::CpdCyclesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/effective/cpd_cycles_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject

If they visit /cpd_cycles/1, redirect to their statement for that cycle



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

def show
  cycle = Effective::CpdCycle.find(params[:id])
  EffectiveResources.authorize!(self, :show, cycle)

  statement = EffectiveCpd.CpdStatement.where(cpd_cycle: cycle, user: current_user).first

  if statement.present?
    redirect_to effective_cpd.cpd_cycle_cpd_statement_build_path(cycle, statement, statement.next_step)
  else
    redirect_to effective_cpd.cpd_cycle_cpd_statement_build_path(cycle, :new, :start)
  end
end