I'm new to Rails. I had created a Rails application earlier and also collected a few data records in the development database. Suppose, I create a new Rails application and I prefer to use the existing development database of the 1st Rails application in my newly created Rails application, how do I do that?

No correct solution


Just change the file config/database.yml and set the database name.

your database.yml should look like this:

  host: localhost
  adapter: mysql
  database: your_database_name [just the name, not the path]
  username: your_username
  password: your_password



You need to change the database name in the database.yml file. The seconnd problem you run into is migrations.

I would copy the migrations form your previous application over so that you maintain migration integrity with version numbers and rolling back if that is needed.

Also, if you are seeing development.locs - that locs refers to the table_name, which in restful context is usually also coincidentally the name of the controller.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow