app/controllers/championships_controller.rb
# Verifies that a season id is provided as parameter; otherwise
# use the current season according to chosen season type
# Assigns the @season instance.
# Use for CSI regional er
#
# == Params:
# id: the season id to be processed by most of the methods (see before filter above)
#
Verifies that a season id is provided as parameter; otherwise
use the current season according to chosen season type
Assigns the @season instance.
Use for CSI regional er

the season id to be processed by most of the methods
Verifies that a season id is provided as parameter ; otherwise use the current season according to chosen season type Assigns the @season instance . Use for CSI regional er the season id to be processed by most of the methods
def prepare_parameters( season_type_code )
    set_season_type( season_type_code )
    @season = Season.find_by_id( params[:id] )
    is_correct_season = if params[:id].present?
      @season_type.present? && @season.present? && (@season.season_type.id == @season_type.id)
    else
      @season_type.present?
    end
    unless ( is_correct_season )
      flash[:error] = I18n.t(:invalid_action_request)
      redirect_back( fallback_location: root_path ) and return
    end
    unless ( @season )
      @current_season_id = Season.get_last_season_by_type( @season_type.code ).id
      set_season( @current_season_id )
      unless ( @season )
        flash[:error] = I18n.t(:invalid_action_request)
        redirect_back( fallback_location: root_path ) and return
      end
    end
  end
def prepare_parameters ( season_type_code ) set_season_type ( season_type_code ) @season = Season . find_by_id ( params [ :id ] ) is_correct_season = if params [ :id ] . present? @season_type . present? && @season . present? && ( @season . season_type . id == @season_type . id ) else @season_type . present? end unless ( is_correct_season ) flash [ :error ] = I18n . t ( :invalid_action_request ) redirect_back ( fallback_location : root_path ) and return end unless ( @season ) @current_season_id = Season . get_last_season_by_type ( @season_type . code ) . id set_season ( @current_season_id ) unless ( @season ) flash [ :error ] = I18n . t ( :invalid_action_request ) redirect_back ( fallback_location : root_path ) and return end end end
Verifies that a season id is provided as parameter; otherwise
use the current season according to chosen season type
Assigns the @season instance.
Verifies that a season id is provided as parameter ; otherwise use the current season according to chosen season type Assigns the @season instance .
# We can either set the season with the default current one, according to the # season type code specified, or we can specify directly a Season :id; in this # case, we must check that the season exists & has the same type specified by # the parameter: # The tuple season & season_type must be correct: # In this case, we'll default to the current season for this type: # DEBUG #      puts "\r\n- prepare_parameters(#{season_type_code}): NO @season_type" # Use the specified season :id or default to the current one: # Find current season when no direct Season.id is specified: # Last check regarding the existance of the Season (in case we had to use the current one): # DEBUG #        puts "\r\n- prepare_parameters(#{season_type_code}): NO @season; params[:id]: '#{params[:id]}', season_id: #{ season_id }, @current_season_id: #{ @current_season_id }"
season_type_code
<not_specific>