Sha256: 710f662a1a1a69a25625a6aa6035fd7c187f0d5d507e8a01acac47143afebce6

Contents?: true

Size: 690 Bytes

Versions: 48

Compression:

Stored size: 690 Bytes

Contents

module Effective
  class CpdCyclesController < ApplicationController
    before_action(:authenticate_user!) if defined?(Devise)

    # If they visit /cpd_cycles/1, redirect to their statement for that cycle
    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

  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
effective_cpd-1.7.2 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.7.1 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.7.0 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.6.5 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.6.4 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.6.3 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.6.2 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.6.1 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.6.0 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.5.1 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.5.0 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.4.8 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.4.7 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.4.6 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.4.5 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.4.4 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.4.3 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.4.2 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.4.1 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-0.6.9 app/controllers/effective/cpd_cycles_controller.rb