Shaun Sweet
Shaun Sweet

Reputation: 689

Issues generating controllers with Rails

I created a Rails application successfully. My page loads on localhost:3000 without problem. When I run

rails generate controller demo index

it returns

sweet$ rails generate controller demo index
   identical  app/controllers/demo_controller.rb
       route  get 'demo/index'
      invoke  erb
       exist    app/views/demo
   identical    app/views/demo/index.html.erb
      invoke  test_unit
   identical    test/controllers/demo_controller_test.rb
      invoke  helper
   identical    app/helpers/demo_helper.rb
      invoke    test_unit
      invoke  assets
      invoke    js
   identical      app/assets/javascripts/demo.js
      invoke    css
   identical      app/assets/stylesheets/demo.css

But it's not creating those files. I checked the directory, and the files don't exist in those directories.
Here is the directory I'm in:

sweet$ pwd
/Users/sweet/dev/simple_cms

which is my app root.

I tried deleting the entire directory and recreating the app three times. I killed all databases in MySQL via the root user. I ran bundle install. The app created successfully each time.

Does anyone know where Rails stores its logic for checking if a file exists or not when generating controllers/views?

Upvotes: 1

Views: 338

Answers (1)

Shaun Sweet
Shaun Sweet

Reputation: 689

I commented out "spring" in the Gemfile, then ran

bundle update
bundle install

and retried making the controller, and it worked.

It must have been running the original application I had deleted long enough to "make it run faster".

"Ruby on Rails : rails generate controller does not work" actually had the answer but my symptom was a bit different in that I was getting output.

Upvotes: 2

Related Questions