Skip to content

Instantly share code, notes, and snippets.

View potapuff's full-sized avatar

Kuzikov Borys potapuff

  • Sumy State University
  • Sumy, Ukraine
View GitHub Profile
VIEW_PATH = 'lib/assets'
namespace :static do
desc 'Render all resources'
task :publicate => :environment do
resources(VIEW_PATH).each do |src, dest|
html= controller.render_to_string(file:src, layout:'application')
dirname = File.dirname(dest)
unless File.directory?(dirname)
FileUtils.mkdir_p(dirname)
## Inspired by Rails memoizable, but use Rails.cache for storing informations
# core object must have id, if memoizible method not static (designed for ActiveRecord)
# each params must have method 'to_s' or be ActiveRecord
# params lenght.to_s might be less then 120 symbols - hasing is big black hole!
module CacheMemoizable
def self.included(base)
base.extend ClassMethods
end
module ClassMethods