Live Rails view rendering for large apps
Since we can grab html directly and display it, here's an idea for a "Live Mode" for views in a rails project.
Start up a ruby process, load the rails environment, and then initiate a request to a specific url. Let it get through the controller portion. Then grab the result of the view rendering directly and render it in an LT frame. If the view rendering is done via fork or continuation, we can then re-run it multiple times whenever the file changes.
The idea is to do all of the database access once, as opposed to multiple times as presently happens with the rails dev server.
Potential pitfalls:
- unrealized scopes cause database access during view rendering. It might be possible to detect instance variables of type ActiveRecord::Relation and load them during the setup process
- assets would still have to be sent. Easiest way to do that is probably via the rails dev server.
- don't forget transaction / connection management
- would have to reconfigure for each new page / set of params.
Smaller rails apps with local databases would probably do fine with implementing something like LiveReload and hitting the full server stack each time. This is for larger apps.