Modern Front-End Development for Rails, Second Edition: Chapter 1 setup

@noelrappin Happy to see the 2nd Edition underway with Rails 7!

In section “The Sample Code” it says chapter_01/01 is “probably the best place to start if you are following along”. But:

  1. In nrclient2-code.zip the chapter_01/01 tree has no models, controllers, views, sample data, etc. If you start from there, you just get the default welcome-to-Rails page.

  2. Switching to chapter_01/02 works better; however, the bin/setup script (and the instructions listed under “The setup script will do the following”) runs rails db:prepare which doesn’t load the seed data. So on the next page where it says to start the server, and “you’ll see the schedule page with […] a lot of schedule information at the bottom” – it’s actually empty. By running rails db:seed I was able to get the sample data.

Thanks! Yes, the sample code chapter numbering is wrong there – the code folder numbering changed and I missed an update spot.

I’ll update the instructions to be correct here.

Just to add to this when you get past the no data the site is unstyled. The chapter 1 source none of the app/assets/builds/application.css include the tailwind.css. I didn’t get a styled site until in chapter 1 I ran the bin/dev and yarn build:css is called.

Also before bin/dev has been called 2 calls to GET “/cable” goes crazy and churns out

Subscription class not found: "ScheduleChannel"
Subscription class not found: "ConcertChannel"

Into the rails output log until you kill the server. I’m going to assume that yarn build getting called solved this

Yeah, I’m going to guess that before bin/dev is called, the JS on the client side doesn’t track with the boilerplate channel classes, Clearly I need to clean up the text here a bit, sorry about that.

Thanks for letting me know.