I was experimenting on how can we improve a page loading time which has loads of JS and image files. It turns out that we can optimize it by including JS files in the end of HTML content. That gives the flexibility to browser to render images and JS files in parallel. The technical point […]
Month: April 2011
What to cache and what not to! – Rails
With fragment caching floating around it always remain to decide how small piece of code should I cache. Is it worth caching a code as it renders a partial, or just because it has a few lines of HTML/ JS / Ruby code, or it makes a few DB calls to fetch data. This blog […]
Tips and Tricks in Ruby on Rails
Use escape_javascript: When you are making an ajax call and in response sending JS that will insert the content in an HTML element, make sure you run escape_javascript on the content. For e.g. $(“#div”).html(‘<%= variable %>’). In this case if variable’s value contains a quote ‘, the resulting JS that would be rendered in browser: $(“#div”).html(‘value_’_with_quote’). This […]
Debugging Production – Ruby on Rails
Stuck with Rails debugging? Here are some useful Commands that you should know and will help you in diagnose your system. First few commands are in general for any production environment. Last few ones are specific to ruby on rails. This is basic diagnose and my next post will elaborate more on the various tools […]