Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Seeds file instructions reference a follow method that is not explained in the tutorial #42

@Natsuki-gitch

Description

@Natsuki-gitch

Hello,

I am currently following the Rails Tutorial (Michael Hartl, 14th Chapter) and encountered an issue with the sample data setup.

The tutorial instructs readers to run the usual commands to reset and seed the database:

$ rails db:migrate:reset
$ rails db:seed

However, the db/seeds.rb file includes code that calls a follow method on the User model:

users = User.all
user = users.first
following = users[2..50]
followers = users[3..40]
following.each { |followed| user.follow(followed) }
followers.each { |follower| follower.follow(user) }

At this point in the tutorial, the follow method is not defined in the User model. There is no explanation in the text about how or where to implement this method, yet the seed instructions require it to run successfully. As a result, running rails db:seed produces a NoMethodError.

This is confusing for learners following the tutorial strictly and prevents them from completing the setup. The tutorial’s instructions and the code in seeds.rb are inconsistent, which could cause unnecessary frustration.

I suggest clarifying the tutorial by either:

  1. Adding a note that the follow method must be implemented in the User model before running db:seed, or
  2. Providing the implementation in the tutorial text at the appropriate point.

Thank you for considering this feedback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions