Some facts/assumptions:
- It is said that Ruby on Rails follows MVC architectural pattern.
- The MVVM (Model View ViewModel), which derives from MVC, offers an abstraction layer, where all the buttons, labels and links (View) are separated from the way models expose data (ViewModel).
- Some Javascript frameworks, that excel in building Single Page Apps, leverage MVVM pattern (for instance Knockout.js).
- If we check Ruby toolbox, we will see a several presenter solutions like Draper and Apotomo that work just as a ViewModel thing.
Assuming there is no bs in my 'facts' section, there is one thing that bothers me:
- Can we call Rails with Draper, Apotomo (or other presenter/decorator) a MVVM solution?
- Can we say we are following MVVM pattern with Rails, if we encapsulate the data from the model in a form of decorator/presenter container with Draper?
- Or is there something missing and we can't call it a MVVM, like Knockout.js?
Thank you for your insights.
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 pattern, these presenters will typically wrap around the active record object and add methods to it that pertain to the presentation.