workarea-commerce / workarea

Workarea is an enterprise-grade Ruby on Rails commerce platform
https://www.workarea.com
Other
327 stars 66 forks source link

Prevent Error on Missing Custom Template View Model Class #556

Closed tubbo closed 3 years ago

tubbo commented 3 years ago

Typically, custom product templates use their own subclass of Workarea::Storefront::ProductViewModel, but this isn't supposed to be necessary if there's no custom logic that needs to be in the view model layer. However, when developers tried to add a custom template without the view model, they received an error. To prevent this, Workarea will now catch the NameError thrown by Storefront::ProductViewModel.wrap in the event of a custom product template not having a view model defined.