0

I am fairly new to Ruby on Rails. I am using it to create a web API application and was wondering if instead of creating a schema based on my Model, can I do the reverse? E.g. is it possible to create model that would fit with an already existing schema? Something like that would be fairly easy in Java World using JPA but I am not so sure about Rails using DSL for databases.

Do I have to manually change the migration files in this case? If yes, is there an easy/recommended way to do this?

Thanks

Tintin
  • 2,853
  • 6
  • 42
  • 74

1 Answers1

0

The only thing that you have to do is to add ActiveRecords with the name of your tables.

https://guides.rubyonrails.org/active_record_basics.html

And yes there is way to reverse engineer it.

There is pretty good article about that: https://codeburst.io/how-to-build-a-rails-app-on-top-of-an-existing-database-baa3fe6384a0

Simon Martinelli
  • 34,053
  • 5
  • 48
  • 82