app/controllers/socials_controller.rb
# Remove friendship action.
#
# === Params:
#     id: the id of the swimming buddy (user) to be removed from the friends of the current user
#
# === GET:
#     Renderes the landing page with the confirmation form.
#
# === DELETE:
#     Removes the friendship row (adding also a news feed article TODO?).
Remove friendship action.
Params:
id: the id of the swimming buddy (user) to be removed from the friends of the current user

Renderes the landing page with the confirmation form.

Removes the friendship row (adding also a news feed article TODO?).
Remove friendship action . Params : id : the id of the swimming buddy ( user ) to be removed from the friends of the current user Renderes the landing page with the confirmation form . Removes the friendship row ( adding also a news feed article TODO? ) .
def remove
    @title = I18n.t('social.remove_friendship')
    @swimming_buddy = User.find_by_id( params[:id] )
    if request.post?                                
      if UserSocializer.new(current_user).remove_with_notify( @swimming_buddy )
        flash[:info] = I18n.t('social.remove_successful')
      else
        flash[:error] = I18n.t('social.remove_error')
      end
      redirect_to( swimmer_radio_path(id: @swimming_buddy.swimmer_id) ) and return
    else
      if SwimmerUserStrategy.new(@swimming_buddy.swimmer).is_editable_by( current_user )
        @submit_title = I18n.t('social.remove_label').gsub( "{SWIMMER_NAME}", @swimming_buddy.name )
        @friendship   = current_user.find_any_friendship_with(@swimming_buddy)
        @destination_path = social_remove_path( id: @swimming_buddy.id )
      else
        flash[:warning] = I18n.t( 'social.warning_generic_not_a_valid_friendship' )
          .gsub( "{SWIMMER_NAME}", @swimming_buddy.name )
        redirect_back( fallback_location: root_path ) and return
      end
      render :ask_confirmation
    end
  end
def remove @title = I18n . t ( 'social.remove_friendship' ) @swimming_buddy = User . find_by_id ( params [ :id ] ) if request . post? if UserSocializer . new ( current_user ) . remove_with_notify ( @swimming_buddy ) flash [ :info ] = I18n . t ( 'social.remove_successful' ) else flash [ :error ] = I18n . t ( 'social.remove_error' ) end redirect_to ( swimmer_radio_path ( id : @swimming_buddy . swimmer_id ) ) and return else if SwimmerUserStrategy . new ( @swimming_buddy . swimmer ) . is_editable_by ( current_user ) @submit_title = I18n . t ( 'social.remove_label' ) . gsub ( "{SWIMMER_NAME}" , @swimming_buddy . name ) @friendship = current_user . find_any_friendship_with ( @swimming_buddy ) @destination_path = social_remove_path ( id : @swimming_buddy . id ) else flash [ :warning ] = I18n . t ( 'social.warning_generic_not_a_valid_friendship' ) . gsub ( "{SWIMMER_NAME}" , @swimming_buddy . name ) redirect_back ( fallback_location : root_path ) and return end render :ask_confirmation end end
Remove friendship action.
Remove friendship action .
# === POST: === # === GET: ===