You need to include the sessions helper for it to be available in the controller/view layers. The application code that you linked to does include the sessions helper, it just does so in the application_controller.rb
file as you can see here.
By default, helper methods are only available to their corresponding controller/views. This means that if you have a users_helper.rb
file in your app/helpers
folder, the methods defined there will be available to the users controller and user views by default.
If you want to use a method from a helper outside of its namespace, it has to be included at the scope that you want access to it. So including the SessionsHelper
in the users controller as you did in your solution would make it available to the users controller and views only. Including a helper in the application controller as done in the example app code makes the helper methods available to all controllers/views in the application.