Class: SimpleTeams::LeaveTeamsController

Inherits:
BaseController show all
Defined in:
app/controllers/simple_teams/leave_teams_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#current_ability

Instance Method Details

#destroyObject



6
7
8
9
10
11
12
# File 'app/controllers/simple_teams/leave_teams_controller.rb', line 6

def destroy
  if @service_object.valid? and @service_object.perform
    redirect_to main_app.url_for(@team.teamable.class), :notice => "You have successfully left the #{@team.name} #{@team.teamable.class.model_name.human}."
  else
    redirect_to team_path(@team), :notice => @service_object.errors[:user_id].first
  end
end