10 Steps to generate rails app from existing database

  1. Model and deploy your database, which yet has nothing to do with your rails app.
  2. Point your rails app config/database.yml to such database
  3. Open terminal
  4. Change directory to you rails app root (run in terminal cd /path/to/my/rails/app/) .
  5. Run in terminal rake db:schema:dump (Generates schema.rb)
  6. Install gem ‘schema_to_scaffold’ (https://github.com/frenesim/schema_to_scaffold/)
  7. Run in terminal scaffold to generate rails scaffold commands and follow what is requested
  8. copy “rails scaffold commands” generated by step 7 on a separated .txt file
  9. Run each “rails scaffold command” separately
  10. Be happy!

Credit to original stack overflow answer here

Leave a Comment

Your email address will not be published. Required fields are marked *