Let's use a generator to generate a HabitsController class with a show action.

$ bin/rails generate controller habits show

It will generate quite a few files, but we're only interested in the controller class. Edit the show action on the HabitsController class to set up an instance of habit.

class HabitsController < ApplicationController
  def show
    @habit = Habit.first
  end
end

At this point, we have a habit to show in our views, which we'll tackle next.