---
title: "Comment by Francisco Quintero on \"Rails Fitness Tracker App Part 2: Routes and Views\" | Hashnode"
description: "Awesome here. Let me suggest you that instead of def set_routine @routine = Routine.find_by( id: params[ :id ]) end You do something like: def set_routine @rout"
url: "https://hashnode.com/posts/rails-fitness-tracker-app-part-2-routes-and-views/5ee1b43b304fa1181a7d60c2/comment/5eeb72767c75e8f7249fc6fa"
---

[Discussion](https://hashnode.com/posts/rails-fitness-tracker-app-part-2-routes-and-views/5ee1b43b304fa1181a7d60c2)

Comment [Rails Fitness Tracker App Part 2: Routes and Views](https://hashnode.com/posts/rails-fitness-tracker-app-part-2-routes-and-views/5ee1b43b304fa1181a7d60c2)

[Francisco Quintero](https://hashnode.com/@cesc1989)

[Jun 18, 2020](https://hashnode.com/posts/rails-fitness-tracker-app-part-2-routes-and-views/5ee1b43b304fa1181a7d60c2/comment/5eeb72767c75e8f7249fc6fa)

Awesome here. Let me suggest you that instead of

```
def set_routine
  @routine = Routine.find_by(id: params[:id])
end
```

You do something like:

```
def set_routine
  @routine = Routine.find(params[:id])
end
```

`.find_by` returns `nil` when it doesn't found nothing and then you could face `NoMethodError for NilClass`.

`.find` raises an exception and you can better handle that with a notification or message or something.
