Are view models used in rails?
- by Valentin Vasilyev
I'm starting to develop a small application in ruby on rails and many questions arise. I should say that I have about 1 year of experience with ASP.NET MVC and feel at home with models views and controllers. I've been using view models extensively (with the help of AutoMapper) and now wondering if view models are used similarly in rails camp.
From various examples (rails casts mainly) I've gathered that it is common to either combine data from multiple models right in your view (which is frowned upon in ASP.NET MVC), or to use virtual attributes on models to obtain "missing" data.
I know that business model should not be modelled after UI needs, for example there should not be a 'password confirm' property in your model, this should be a view model property.
Rails virtual properties seem to violate this principle.
How is it done in rails?
Thanks.