Is there a Ruby ORM that uses simple ruby ​​objects and does not require you to inherit from the base class?

I am interested in writing a clean domain model of rubies and adding persistence in the future.

Some tools that I used with other languages, such as the Microsoft Entity Framework, now allow you to use simple objects for your domain data models, and then add them to the persistence class later using conventions-based matching. For example, these simple objects:

Plain C # classes

The database context classes are added here:

Plain C # classes added to db class

This can be very useful not only to separate problems during testing, but also allows you to use more manageable code, compliance with SRP and the ability to easily change your save level if necessary.

I can’t find anything that fits the bill right now ORM-wise in the ruby ​​sphere. ActiveRecord, DataMapper and Sequel all inherit from the base class tied to these frameworks. Are there any projects, alternative methods or methods to achieve this?

+4
source share
1 answer

Take a look at this. This contributes to a good separation of problems between your domain logic and the retention infrastructure layer. Obviously, it does not yet have all the attractive ActiveRecord tools, but it is a good project and worth a look:

https://github.com/fredwu/datamappify

UPDATE

As we can see in this discussion , unfortunately, the project is no longer supported .:(

+1
source

Source: https://habr.com/ru/post/1414541/


All Articles