Sha256: 8d76d6acf285e32c74a712d92c0dcf3e218945e373d31432cbffd5c1b2a6b37a
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
# https://gist.github.com/af7e572c2dc973add221 module Storefront class Railtie < Rails::Railtie initializer "storefront.insert_into_action_view" do ActiveSupport.on_load :action_view do base = "#{File.expand_path(File.dirname(__FILE__))}/helpers" Dir["#{base}/*"].each do |path| next if File.directory?(path) constant_name = File.basename(path, File.extname(path)).gsub("/", "::").camelize ActionView::Base.send :include, "Storefront::#{constant_name}".constantize end end ActiveSupport.on_load :active_record do # end ActiveSupport.on_load :action_controller do base = "#{File.expand_path(File.dirname(__FILE__))}/helpers" Dir["#{base}/*"].each do |path| next if File.directory?(path) || File.basename(path) =~ /(form|table|dashboard)/ constant_name = File.basename(path, File.extname(path)).gsub("/", "::").camelize ActionController::Base.send :include, "Storefront::#{constant_name}".constantize end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
storefront-0.2.1 | lib/storefront/railtie.rb |
storefront-0.2.0 | lib/storefront/railtie.rb |