Permalink
Browse files

Added logic for changing the Neighborhood

  • Loading branch information...
1 parent 6fd74ea commit fd3b232746c9bebd96d230d8c31bb9c5ae395f9b @jaderobbins jaderobbins committed Nov 3, 2011
Showing with 2 additions and 13 deletions.
  1. +2 −13 app/controllers/admin/volunteers_controller.rb
@@ -24,20 +24,9 @@ def edit
def update
@v = Volunteer.find(params[:id])
- team_lead = params[:volunteer].delete(:is_team_lead)
@v.update_attributes!(params[:volunteer])
-
- neighborhood = @v.neighborhood
-
- # if they are the team lead, we need to remove the team lead from params
- # and update the neighborhood table instead
- if team_lead
- neighborhood.team_lead = @v
- neighborhood.save
- elsif neighborhood.team_lead.id == @v.id
- neighborhood.team_lead = nil
- neighborhood.save
- end
+ @v.neighborhood.team_lead = @v
+ @v.neighborhood.save
redirect_to admin_volunteers_path
end

0 comments on commit fd3b232

Please sign in to comment.