Skip to content

Instantly share code, notes, and snippets.

@Amitesh
Created June 25, 2011 07:59
Show Gist options
  • Save Amitesh/1046278 to your computer and use it in GitHub Desktop.
Save Amitesh/1046278 to your computer and use it in GitHub Desktop.
Set the simple-navigation file path of a Rails Engine app to auto load path of Rails 3 Main App
require "rails"
require 'simple-navigation'
module MyEngine
class Engine < Rails::Engine
#Give the absolute path of file
#config.autoload_paths << File.expand_path("../../../config/navigations", __FILE__)
SimpleNavigation.config_file_path = File.expand_path("../../../config/navigations", __FILE__)
# 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
#generators for engine models and views
config.app_generators do |g|
g.orm :active_record
g.template_engine :erb
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment