Rails environment files and non-config config

Posted by Tim Connor Fri, 22 Jun 2007 17:03:00 GMT

I wanted to move my Markaby::Builder.set(:indent, 2) line out of my global environment.rb and into the development.rb, since reparsing the output to indent the html source slows it down ever more, and I don’t need that outside of the dev environment. The environment specific files are processed at Rails::Initializer time, though, and thus things like plug-ins aren’t loaded yet. Luckily, I found this article on environments and the Rails initialisation process, and thus did this in my development.rb

config.after_initialize do
  Markaby::Builder.set(:indent, 2)
end
Comment form

(leave url/email »)

Help with Textile (code)