Sha256: caf5c751496f565c84defa5b46a6fba426f98cb517fb3561b1b84588282bb024
Contents?: true
Size: 1.22 KB
Versions: 5
Compression:
Stored size: 1.22 KB
Contents
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 Object.send :include, Storefront::ModelHelper 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)/ # need to do these as traditional helper declarations somehow constant_name = File.basename(path, File.extname(path)).gsub("/", "::").camelize ActionController::Base.send :include, "Storefront::#{constant_name}".constantize end ActionController::Base.send :before_filter, :configure_storefront end end end end
Version data entries
5 entries across 5 versions & 1 rubygems