Displaying 3 results from an estimated 3 matches for "jmfaber".
Did you mean:
mfaber
2010 Nov 05
9
[patch] Let's use <%== %> instead of <%= raw() %>
I''ve submitted a small patch to make Rails behave properly with the
Erubis <%== %> construct. For some reason the current behaviour of
that tag in Rails 3 is to escape the contents _twice_ which is
probably a bug.
I offer three suggestions why this is a good idea:
- The syntax is cleaner. It can avoid a lot of .html_safe and raw in
your views. I especially like the conciseness of
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:
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