Ruby on Rails Threadly Model Generation Issue


#1

Learn Ruby on Rails: Threadly Exercise
Exercise Link: https://www.codecademy.com/courses/learn-rails/projects/learn-rails_threadly

The issue I have is at step 4 of the Threadly exercise for the Learn Ruby on Rails track. The command "rails generate model Post" was run ... and then the cursor remains flashing and never goes back to the "$" symbol. I think it's stuck because nothing has changed in 5 minutes. I've tried resetting the exercise three times. I had no trouble with generating generating the app named "threadly", changing directories to "threadly", or installing the Gemfile. Why is Rails stuck? How do I proceed? I initially encountered this error while using Chrome. Switching to Firefox didn't fix the issue. I can't continue with the exercise because the required file in db/migrate/ never appears to get generated.


I just tried out the same command "rails generate model Message" on the Model exercise from earlier in the Learn Ruby on Rails track and the command runs without issue (I already ran the command for this exercise, so it asks me if I'd like to replace the old migration file.) The command appears to work on an earlier exercise, so I think it's particular to the "Threadly" exercise.


#2

Hi @dhalv001,

Thanks for trying everything we suggest before posting here!

I don’t have any suggestions that will fix the terminal, but you could create a new file yourself. Name it YYYYMMDDHHMMSS_create_posts.rb (as I write this, that’d be approximately 20170728073100_create_posts.rb)

After you create the file, put this code in it and hopefully you’ll be able to proceed.

Click to view code
class CreatePosts < ActiveRecord::Migration
  def change
    create_table :posts do |t|
      t.string :comment
      
      t.timestamps
    end
  end
end


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.