app/controllers/trainings_controller.rb
# Verifies that the training id is provided as a parameter
# and that the corresponding training is owned by the current user.
# Otherwise, it redirects to the home page.
# Assigns the @training instance when successful.
# (Assumes log-in has been enforced elsewhere.)
#
# == Controller Params:
# id: the user_training id to be processed by most of the methods (see before filter above)
#
Verifies that the training id is provided as a parameter
and that the corresponding training is owned by the current user.
Otherwise, it redirects to the home page.
Assigns the @training instance when successful.
(Assumes log-in has been enforced elsewhere.)

Controller Params:
id: the user_training id to be processed by most of the methods
Verifies that the training id is provided as a parameter and that the corresponding training is owned by the current user . Otherwise it redirects to the home page . Assigns the @training instance when successful . ( Assumes log - in has been enforced elsewhere . ) Controller Params : id : the user_training id to be processed by most of the methods
def verify_ownership
    set_training
    if TrainingAccessibility.new( current_user, @training ).is_owned
      return
    else
      flash[:error] = I18n.t(:invalid_action_request)
      redirect_to( trainings_path() ) and return
    end
  end
def verify_ownership set_training if TrainingAccessibility . new ( current_user , @training ) . is_owned return else flash [ :error ] = I18n . t ( :invalid_action_request ) redirect_to ( trainings_path ( ) ) and return end end
Verifies that the training id is provided as a parameter
and that the corresponding training is owned by the current user.
Verifies that the training id is provided as a parameter and that the corresponding training is owned by the current user .