Using an ORM has a lot of benefits over using standard SQL directly. Let's discuss some of them:
- Quick development: One needs to create tables manually and manage them when using SQL directly. Using an ORM reduces all such overheads.
We can define classes that correspond to the table structure and every time we restart the application, the database is updated.
- Handling errors and transactions: Instead of writing SQL statements to manage transactions and handle errors, we can write simple Ruby code to do the same.
- Independent of the DBMS: ORMs are independent of the DBMS used. We can use the exact same code to communicate with any of the DBMS. We will just need to specify it while defining the connection and everything else will ...