0

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.

Luka Kerr
  • 4,161
  • 7
  • 39
  • 50
xuq01
  • 588
  • 4
  • 17
  • `rails g model` will create an ActiveRecord model by default - but you've disabled ActiveRecord. What's the behaviour you're expecting instead? Are you using a different ORM that you expect to be invoked at this point? – pat Oct 23 '16 at 02:39
  • I got it. I'm using Google Cloud Datastore, which is not a ORM, with this Rails app. – xuq01 Oct 23 '16 at 02:51

1 Answers1

0

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.

pat
  • 16,116
  • 5
  • 40
  • 46