search for: fjan

Displaying 2 results from an estimated 2 matches for "fjan".

Did you mean: fan
2008 Feb 01
4
How to sanitize _before_ going into the database?
I use a call to the sanitize method every time I render some user input, but it would be much nicer if I could clean it up once before putting it into the database and avoid having to call the (relatively expensive) sanitize every time I render a page. My first thought was to just add something like: def message=(x) self[:message]=sanitize(x) end However, the sanitize helper cannot be called
2010 Nov 20
0
Enabling preprocessing in Erubis makes views much faster
I wrote a 5 line hack that you can drop into your initializers directory to enable preprocessing in Erubis. This will run code in < %=== %> brackets at compile time making views considerably faster for rails helpers that only need to be evaluated once instead of on each render (the Erubis docs mention 20-40% speed increase but obviously it depends on the amount you precompile). For example: