Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Ruby on Rails with Draper or Apotomo a MVVM?

Some facts/assumptions:

  1. It is said that Ruby on Rails follows MVC architectural pattern.
  2. 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).
  3. Some Javascript frameworks, that excel in building Single Page Apps, leverage MVVM pattern (for instance Knockout.js).
  4. 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.

like image 587
socjopata Avatar asked Jun 18 '12 10:06

socjopata


Video Answer


1 Answers

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.

like image 149
Jesse Wolgamott Avatar answered Oct 24 '22 03:10

Jesse Wolgamott