rails 3:how to generate models for existing database tables

dark_ruby picture dark_ruby · Nov 7, 2010 · Viewed 26.1k times · Source

I've configured my database.yml to point to my existing mysql database

how can I generate models from it?

rails generate model existing_table_name

only gives an emty model..

Answer

Boško Ivanišević picture Boško Ivanišević · Sep 12, 2012

You can try Rmre. It can create models for existing schema and it tries to create all relationships based on foreign keys information.