Search code examples
ruby-on-railsrails-activerecordrails-generaterails-generatorsruby-2.3

Skipping Active Record breaks Rails Generator


I created a new Rails project with the -O --api flags turned on, and rails g model is now broken for me: it does nothing and simply says "running via Spring preloader" (its not a Spring bug as I've tried removing Spring) and returns.

After that, I created a new project (exactly the same, just without -O), and rails g model worked fine. Is it that skipping AR breaks generators? If so, how shall I avoid?

I'm using Ruby 2.3.1 and Rails 5.0.0.1 on Ubuntu Linux 16.04 LTS.


Solution

  • rails g model is only useful for ActiveRecord models (by default) or other model types that have an integrated generator. You can invoke the latter by using the -o flag when running rails g model.

    However, there might not be such an integration for Google Cloud Datastore, so I think you're going to have to manage your models manually.