Skip to content

Instantly share code, notes, and snippets.

@rknLA
Forked from jipiboily/gist:1955326
Created March 2, 2012 03:28
Show Gist options
  • Save rknLA/1955344 to your computer and use it in GitHub Desktop.
Save rknLA/1955344 to your computer and use it in GitHub Desktop.
How to apply an override with Deface
# Step 1: you need to add the files in say "app/overrides", ie: "/app/overrides/insert_this_here.rb"
# Step 2: add that in your application.rb to load them (and decorators)
config.to_prepare do
# Load application's model / class decorators (optional for Deface, but you should have it in your app if you use Spree AFAIK.
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
Rails.configuration.cache_classes ? require(c) : load(c)
end
# Load application's view overrides
Dir.glob(File.join(File.dirname(__FILE__), "../app/overrides/*.rb")) do |c|
Rails.configuration.cache_classes ? require(c) : load(c)
end
end
# Note that the :name of the deface has to fit the file name in that directory + .rb at the end of the file, but not in :name. ie: :name => "insert_this_here"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment