Growing up
I didn’t think this moment would come this soon for me. I’ve only been playing with Rails and Ruby for about 3 months.
I did some growing up as a Rails developer last night when I had to change Rails core for Noobkit.
Testing ‘production’ at 3am right before I “quickly” put up the new build brought up a problem with page caching. Noobkit is using URLs which include ‘::’ characters in their paths and silly Rails tries to create fragment cache files with those characters in the path.
That resulted in an obscure and very non descriptive error Errno::EINVAL. This had to be fixed, and so it was:
module NoobkitCaching
def self.append_features(base)
base.extend(ClassMethods)
end
module ClassMethods
private
def page_cache_file(path)
super.gsub(/::|\^/, '')
end
end
end
# and then in environment.rb
ActionController::Base.send :include, NoobkitCaching
No comments yet, be the first one!
Leave a Reply