V
V
Valery Semenov2012-07-05 11:29:24
Ruby on Rails
Valery Semenov, 2012-07-05 11:29:24

How justified is the following scheme?

Usually, in RoR, all application logic is in ActiveRecord models.
Out of habit, I add another level of abstraction - entity classes that use ActiveRecord model calls. Thereby separating the levels of logic (medium and low). In the controllers, the methods of the generated classes are called.
How justified is such a scheme? Maybe RoR does not need such detail.
ps
I'm switching to ruby ​​from another language.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Mikhail Osher, 2012-07-05
@Ravall

Depends on the task.
For example, if you have 16 databases on 4 servers, and data for a particular task is pulled from more than one source (read - databases), then why not?

A
Anton Taraev, 2012-07-06
@ataraev

do not reinvent the wheel everything has already been invented before you, for example, look at the Architecture of Enterprise Software Applications

S
Source, 2012-07-06
@Source

It is not very clear what responsibility you assign to these entity classes.
For example, I often use separate classes for the ViewModel.
If you wish, you can even use a ready-made gem for this: github.com/jcasimir/draper

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question