# http://olympiad.posterous.com/how-to-building-a-rails-3-engine-and-set-up-t # http://www.themodestrubyist.com/2010/03/05/rails-3-plugins---part-2---writing-an-engine/ # http://www.themodestrubyist.com/2010/03/16/rails-3-plugins---part-3---rake-tasks-generators-initializers-oh-my/ require "ecommerce" require "rails" module Ecommerce class Engine < Rails::Engine # How Do We Get JS To Load (for the client app) # 1. We must make the ecommerce engine's public directory available to the client app initializer "static assets" do |app| app.middleware.use ::ActionDispatch::Static, "#{root}/public" end # 2. Now, add our js file to the client's default js files list. For more, see # Rails Config Hooks: http://andre.arko.net/2010/10/15/extending-rails-3-with-railties/ config.before_initialize do config.action_view.javascript_expansions[:defaults] += %w(ecommerce.js) end end end