app/controllers/trainings_controller.rb
# Verifies that a training id is provided as a parameter (except for an AJAX request, in which case it may be nil).
# Otherwise, it redirects to the home page.
# Assigns the @training instance when successful.
# (Assumes log-in has been enforced elsewhere.)
#
# == Controller Params:
# id: the training id to be processed by most of the methods (see before filter above)
#
Verifies that a training id is provided as a parameter (except for an AJAX request, in which case it may be nil).
Otherwise, it redirects to the home page.
Assigns the @training instance when successful.
(Assumes log-in has been enforced elsewhere.)

Controller Params:
id: the training id to be processed by most of the methods
Verifies that a training id is provided as a parameter ( except for an AJAX request in which case it may be nil ) . Otherwise it redirects to the home page . Assigns the @training instance when successful . ( Assumes log - in has been enforced elsewhere . ) Controller Params : id : the training id to be processed by most of the methods
def verify_visibility
    set_training
    unless TrainingAccessibility.new( current_user, @training ).is_visible
      flash[:error] = I18n.t(:invalid_action_request)
      redirect_to( trainings_path() ) and return
    end
  end
def verify_visibility set_training unless TrainingAccessibility . new ( current_user , @training ) . is_visible flash [ :error ] = I18n . t ( :invalid_action_request ) redirect_to ( trainings_path ( ) ) and return end end
Verifies that a training id is provided as a parameter (except for an AJAX request, in which case it may be nil).
Verifies that a training id is provided as a parameter ( except for an AJAX request in which case it may be nil ) .