Skip to content

Instantly share code, notes, and snippets.

@Amitesh
Created June 25, 2011 07:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Amitesh/1046269 to your computer and use it in GitHub Desktop.
Save Amitesh/1046269 to your computer and use it in GitHub Desktop.
Set Rails Engine/Gem public assets path, to server it from Engine/Gem itself
require "rails"
module MyEngine
class Engine < Rails::Engine
# We can add all of the public assets from our engine and make them
# available to use. This allows us to use javascripts, images, stylesheets
# etc.
initializer "static assets" do |app|
app.middleware.insert_before(::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public")
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment