Skip to content

Commit

Permalink
404 when we can't find roaster or bag
Browse files Browse the repository at this point in the history
  • Loading branch information
miharekar committed Jan 12, 2025
1 parent d9b2ec5 commit 2fb0a78
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/controllers/api/coffee_bags_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ def index
end

def show
coffee_bag = @roaster.coffee_bags.find_by(id: params[:id])
coffee_bag = @roaster.coffee_bags.find(params[:id])
render json: coffee_bag.to_api_json
end

private

def find_roaster
@roaster = Current.user.roasters.find_by(id: params[:roaster_id])
@roaster = Current.user.roasters.find(params[:roaster_id])
end
end
end
2 changes: 1 addition & 1 deletion app/controllers/api/roasters_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def index
end

def show
roaster = Current.user.roasters.find_by(id: params[:id])
roaster = Current.user.roasters.find(params[:id])
render json: roaster.to_api_json
end
end
Expand Down

0 comments on commit 2fb0a78

Please sign in to comment.