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.4.0 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.3.7 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.3.6 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.3.5 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.3.4 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.3.3 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.3.2 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.3.1 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.3.0 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.2.4 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.2.3 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.2.2 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.2.1 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.2.0 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.1.3 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.1.2 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.1.1 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.1.0 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-1.0.0 app/controllers/effective/cpd_cycles_controller.rb
effective_cpd-0.6.8 app/controllers/effective/cpd_cycles_controller.rb