app/controllers/api/v1/meetings_controller.rb
# Tags/Untags a specific meeting id for the specified TeamAffiliation.id.
# (JSON format) PUT-only action.
#
# Keep in mind that the action in named #tag_for_team for brevity, but the
# actual tag is tied to a TeamAffiliation id, not a Team id.
#
# === 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 a specific meeting id for the specified TeamAffiliation.id.
(JSON format) PUT-only action.

Keep in mind that the action in named #tag_for_team for brevity, but the
actual tag is tied to a TeamAffiliation id, not a Team 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 a specific meeting id for the specified TeamAffiliation . id . ( JSON format ) PUT - only action . Keep in mind that the action in named #tag_for_team for brevity but the actual tag is tied to a TeamAffiliation id not a Team id . the Meeting . id to be tagged / untagged for the current_user . t : the TeamAffiliation . id to be tagged / untagged for the current_user .
def tag_for_team
    meeting = Meeting.find_by_id( params[:id] )
    if meeting && params[:t].present?
      if meeting.tags_by_team_list.include?( "ta#{ params[:t] }" )
        meeting.tags_by_team_list.remove( "ta#{ params[:t] }" )
      else
        meeting.tags_by_team_list.add( "ta#{ params[:t] }" )
      end
      if meeting.save
        render( status: :ok, json: { success: true } ) and return
      else
        render( status: 422, json: { success: false, error: "Error during save!" } )
      end
    end
    render( status: 422, json: { success: false, error: "Invalid parameters!" } )
  end
def tag_for_team meeting = Meeting . find_by_id ( params [ :id ] ) if meeting && params [ :t ] . present? if meeting . tags_by_team_list . include? ( "ta#{ params[:t] }" ) meeting . tags_by_team_list . remove ( "ta#{ params[:t] }" ) else meeting . tags_by_team_list . add ( "ta#{ params[:t] }" ) end if meeting . save render ( status : :ok , json : { success : true } ) and return else render ( status : 422 , json : { success : false , error : "Error during save!" } ) end end render ( status : 422 , json : { success : false , error : "Invalid parameters!" } ) end
Tags/Untags a specific meeting id for the specified TeamAffiliation.id.
Tags / Untags a specific meeting id for the specified TeamAffiliation . id .
# Meeting found? # Meeting already tagged? # Save and return result: