app/controllers/taggings_controller.rb
# Tags/Untags the specified Meeting :id as "favourite" for the current_user
#
# 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.
#
Tags/Untags the specified Meeting :id as "favourite" for the current_user
Returns the updated partial with the starred/unstarred meeting name,
rendered via AJAX.

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