app/controllers/taggings_controller.rb
# Tags/Untags the specified Meeting :id as "favourite" for the specified
# TeamAffiliation.id as param[:t].
#
# Returns the updated partial with the starred/unstarred meeting name,
# rendered via AJAX.
#
# === Params:
# - id: the Meeting.id to be tagged/untagged for the current_user.
# - t: the TeamAffiliation.id to be tagged/untagged for the current_user.
#
Tags/Untags the specified Meeting :id as "favourite" for the specified
TeamAffiliation.id as param[:t].

Returns the updated partial with the starred/unstarred meeting name,
rendered via AJAX.

the Meeting.id to be tagged/untagged for the current_user.
t: the TeamAffiliation.id to be tagged/untagged for the current_user.
Tags / Untags the specified Meeting : id as " favourite " for the specified TeamAffiliation . id as param [ : t ] . Returns the updated partial with the starred / unstarred meeting name rendered via AJAX . the Meeting . id to be tagged / untagged for the current_user . t : the TeamAffiliation . id to be tagged / untagged for the current_user .
def meeting_for_team
    logger.debug( "\r\n*********** Taggings#meeting_for_team ***********" )
    if request.xhr? && request.post? && params[:id].present?
      meeting = Meeting.find_by_id( params[:id] )
      if meeting && params[:t].present?
        @meeting_id = meeting.id
        @team_affiliation_id = params[:t]
        if meeting.tags_by_team_list.include?( "ta#{ params[:t] }" )
          meeting.tags_by_team_list.remove( "ta#{ params[:t] }" )
          @is_starred = false
        else
          meeting.tags_by_team_list.add( "ta#{ params[:t] }" )
          @is_starred = true
        end
        logger.info("[I] - Taggings#meeting_for_team: meeting id: #{ @meeting_id }, team_affiliation.id: #{ @team_affiliation_id }, starred: #{ @is_starred }")
        if meeting.save
          @is_saved_ok = true
          logger.info("[I] - Taggings#meeting_for_team: saved OK.")
        else
          @is_saved_ok = false
          logger.error("[E] - Taggings#meeting_for_team: ERROR during save!")
          flash[:error] = I18n.t("tags.error_during_save")
        end
      else
        logger.warn("[W] - Taggings#meeting_for_team: meeting or params[:t] not set!")
      end
    else
      logger.warn("[W] - Taggings#meeting_for_team: invalid request!")
    end
  end
def meeting_for_team logger . debug ( "\r\n*********** Taggings#meeting_for_team ***********" ) if request . xhr? && request . post? && params [ :id ] . present? meeting = Meeting . find_by_id ( params [ :id ] ) if meeting && params [ :t ] . present? @meeting_id = meeting . id @team_affiliation_id = params [ :t ] if meeting . tags_by_team_list . include? ( "ta#{ params[:t] }" ) meeting . tags_by_team_list . remove ( "ta#{ params[:t] }" ) @is_starred = false else meeting . tags_by_team_list . add ( "ta#{ params[:t] }" ) @is_starred = true end logger . info ( "[I] - Taggings#meeting_for_team: meeting id: #{ @meeting_id }, team_affiliation.id: #{ @team_affiliation_id }, starred: #{ @is_starred }" ) if meeting . save @is_saved_ok = true logger . info ( "[I] - Taggings#meeting_for_team: saved OK." ) else @is_saved_ok = false logger . error ( "[E] - Taggings#meeting_for_team: ERROR during save!" ) flash [ :error ] = I18n . t ( "tags.error_during_save" ) end else logger . warn ( "[W] - Taggings#meeting_for_team: meeting or params[:t] not set!" ) end else logger . warn ( "[W] - Taggings#meeting_for_team: invalid request!" ) end end
Tags/Untags the specified Meeting :id as "favourite" for the specified
TeamAffiliation.id as param[:t].
Tags / Untags the specified Meeting : id as " favourite " for the specified TeamAffiliation . id as param [ : t ] .
# DEBUG #    logger.debug( params.inspect ) # === AJAX POST-only === # Meeting found? # Meeting already tagged? # Store save status: