Is Ruby on Rails with Draper or Apotomo MVVM?

Some facts / assumptions:

  • Ruby on Rails is said to follow the MVC architectural pattern.
  • MVVM (Model View ViewModel), which is obtained from MVC, offers an abstraction layer where all buttons, labels and links (View) are separated from the way the data is displayed (ViewModel).
  • Some Javascript frameworks that are superior in creating Single Pages Apps use the MVVM pattern (e.g. Knockout.js).
  • If we check the Ruby toolbar , we will see several presentation solutions, such as Draper and Apotomo, which work the same as the ViewModel.

Assuming there is no bs in the facts section, one thing bothers me:

  • Can Rails be called with Draper, Apotomo (or another host / decorator) MVVM solution?
  • Can we say that we follow the MVVM pattern with Rails if we encapsulate data from the model as a decorator / presenter container using Draper?
  • Or is something missing there and we cannot name it MVVM, for example Knockout.js?

Thank you for your understanding.

+7
source share
1 answer

Not in my opinion .... I think of MVVM as creating specific view objects that are disconnected from the underlying data / domain object.

With the Rails presenter template, these presenters typically wrap around the active recording object and add presentation-related methods to it.

+3
source

All Articles