Skip to content

Instantly share code, notes, and snippets.

@jipiboily
Created March 2, 2012 03:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jipiboily/1955326 to your computer and use it in GitHub Desktop.
Save jipiboily/1955326 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