Skip to content

Commit

Permalink
Remove unnecessary json responders
Browse files Browse the repository at this point in the history
  • Loading branch information
brentvatne committed Mar 22, 2012
1 parent 017bc0f commit d051907
Showing 1 changed file with 9 additions and 28 deletions.
37 changes: 9 additions & 28 deletions app/controllers/people_controller.rb
Expand Up @@ -17,40 +17,21 @@ def edit
end

def update
respond_to do |format|
if @person.update_attributes(params[:person])
format.html do
redirect_to edit_person_path(@person), :notice =>
"Successfully updated information for #{@person.github_nickname}"
end
format.json do
head :no_content
end
else
format.html do
flash[:alert] = "Unable to update #{@person.github_nickname}"
decorate_person
render :edit
end
format.json do
render :json => @person.errors, :status => :unprocessable_entity
end
end
if @person.update_attributes(params[:person])
redirect_to edit_person_path(@person), :notice =>
"Successfully updated information for #{@person.github_nickname}"
else
flash[:alert] = "Unable to update #{@person.github_nickname}"
decorate_person
render :edit
end
end

def destroy
@person.destroy

respond_to do |format|
format.html do
redirect_to people_url, :notice =>
"#{@person.github_nickname} has been permenantly deleted"
end
format.json do
head :no_content
end
end
redirect_to people_url, :notice =>
"#{@person.github_nickname} has been permenantly deleted"
end

# People are created in two ways:
Expand Down

0 comments on commit d051907

Please sign in to comment.