Created
February 29, 2012 15:50
-
-
Save sirmxanot/1941899 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def destroy | |
@expense = Expense.find(params[:id]) | |
if @expense.user_id == current_user.id | |
@expense.destroy | |
flash[:success] = "You have successfully deleted the expense." | |
else | |
flash[:error] = "You can't delete expenses that you didn't create." | |
end | |
respond_to do |format| | |
format.html { redirect_to expenses_url } | |
format.json { head :ok } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment