---
title: "Discussion on \"Rails Fitness Tracker App Part 2: Routes and Views\" | Hashnode"
description: "Discussion on \"Rails Fitness Tracker App Part 2: Routes and Views\". This is Part 2 of a  series  of posts about my experience building my first Rails application. Read Part 1   here \nAt this point of the project, I have successfully pulled off 3rd-party authentication using Devise and OmniAuth! \n\nSo now, along with s..."
url: "https://hashnode.com/posts/rails-fitness-tracker-app-part-2-routes-and-views/5ee1b43b304fa1181a7d60c2"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Rails Fitness Tracker App Part 2: Routes and Views](https://blog.mydevdiary.net/rails-fitness-tracker-app-part-2-routes-and-views?utm_source=hashnode&utm_medium=feed)

This is Part 2 of a series of posts about my experience building my first Rails application. Read Part 1 here At this point of the project, I have successfully pulled off 3rd-party authentication using Devise and OmniAuth! So now, along with s...

Jun 11, 2020 · blog.mydevdiary.net  
Read the article

-   [#ruby-on-rails](https://hashnode.com/tag/ruby-on-rails)
-   [#ruby](https://hashnode.com/tag/ruby)
-   [#projects](https://hashnode.com/tag/projects)
-   [#rails](https://hashnode.com/tag/rails)

## Written by

[Brandon Dusch](https://hashnode.com/@Dusch4593)

@Dusch4593 · Pittsburgh, PA, USA

  
[View profile](https://hashnode.com/@Dusch4593)

Developer and Writer

I'm a life-long, self-directed learner with a love for libraries, documentation, and all things tech. Currently serving the people at the Carnegie Library of Pittsburgh 📚 Formerly @ Codédex 👾 and Codecademy 🧑🏻‍💻 Extracurriculars (in no particular order): 🧑🏻‍🍳 Cooking 📖 Reading (mostly non-fic of all kinds) 🎸 Listening to/playing music 🎙️ Enjoying awesome podcasts. 🏃🏻 Running, walking, moving in general! :D Thanks for reading!

## Responses 1

Markdown supported · ⌘↵ to post

[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.
