Rails for a long time had ApplicationController class. Since Rails 4, it also now has ApplicationModel class. But views are still anonymous classes built at runtime.
Debugger in view rendering phase:
self.class
=> #Class:0x007fc0096562f8 < ActionView::Base
This is hard to extend and understand what’s inside. For example, if I want to build a custom view renderer that can work independently of controller context (in our case, make it render stuff asynchronously in delayed job), but still have access to the application helpers, routes, and all the other custom code we have in our views.
How worthwhile would it be to have a concrete ApplicationView < ActionView::Base, returning something like:
self.class
=> #<ApplicationView:0x007fc79dd20b88 …>
Regular views would still work as before, but now if some custom class extends ApplicationView, they would get the routes, helpers, etc. out of the box in same configuration as the above anonymous class example has them, instead of having to subclass from ActionView::Base (a skeleton class without any app-specific configuration) and have configure it manually to match what their regular Rails views would have. Convention over Configuration?
Thanks!