I have an erb template in which I need to use:
CGI.unescapeHTML (someEscapedHTML)
Therefore, I need to require "cgi", however the following fails:
<% require 'cgi' %>
With an error:
cannot duplicate nilclass
First of all, you do not need stones or libraries in ERB. Then CGI requires Rails itself.
If you want to prevent Rails 3 from being automatically shielded, use
<%= data.html_safe %>
instead.
I personally would never put a require query in a view because 1) it is ugly and 2) what if another view is required that requires?
config/application.rb config/initializers.
config/application.rb
config/initializers