Skip to content

Commit

Permalink
Merge pull request #151 from loftwah/dl/links-achievement-bug
Browse files Browse the repository at this point in the history
don't trust ai code
  • Loading branch information
loftwah authored Sep 14, 2024
2 parents 5b544b3 + 56e8a7d commit d08aef5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions app/controllers/achievements_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def new
def create
@achievement = current_user.achievements.build(achievement_params)
if @achievement.save
redirect_to @achievement, notice: 'Achievement was successfully created.'
redirect_to achievements_path, notice: 'Achievement was successfully created.'
else
render :new
end
Expand All @@ -49,8 +49,7 @@ def edit
def update
@achievement = current_user.achievements.find(params[:id])
if @achievement.update(achievement_params)
# After updating, redirect to the show page, not the URL
redirect_to @achievement, notice: 'Achievement was successfully updated.'
redirect_to achievements_path, notice: 'Achievement was successfully updated.'
else
render :edit
end
Expand Down
5 changes: 2 additions & 3 deletions app/controllers/links_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def new
def create
@link = current_user.links.build(link_params)
if @link.save
redirect_to @link, notice: 'Link was successfully created.'
redirect_to links_path, notice: 'Link was successfully created.'
else
render :new
end
Expand All @@ -50,8 +50,7 @@ def edit
def update
@link = current_user.links.find(params[:id])
if @link.update(link_params)
# After updating, redirect to the show page, not the URL
redirect_to @link, notice: 'Link was successfully updated.'
redirect_to links_path, notice: 'Link was successfully updated.'
else
render :edit
end
Expand Down

0 comments on commit d08aef5

Please sign in to comment.