I’m currently developing my Rails app on my local machine. I have no DB installed on my local machine, and I’m sending my codes to remote testing server which actually runs the app in development mode.
Until yesterday all commands like rails g model foo or rails g controller foo on my local machine worked with no errors.
But now all of rails generate commands started to fail due to no database connections. I think the direct reason is because I made some changes to my app configs, but I’m not sure where the changes are.
I guess the wrong part is that rails generate commands are always invoking active_record
which always verifies the DB connection.
Now, my question is:
Is there any way to temporally disable rails to verify the database connections, for local development(which has no DB connection available)?
I tried removing config/database.yml but it didn’t help.
Your local development environment needs to have the same sort of facilities as the application requires. If you have database backed models then you need a database, preferably the same one as used when deploying the application so your tests are useful.
It really shouldn’t be a big deal to set up a database for local development. Depending on your platform there are usually many different easy to use installers available.
Uploading your code changes to a remote server for execution is a really dysfunctional development model. If you have no alternative, it might be best to create the models on the remote system and pull them down to edit.