Figured out an even better solution that also allows you to set default values (incase the app using the engine doesn't specify a config)...
- Create config variables in your app's
/config/initializers/blog.rb
like this:
Blog.setup do |config|
config.site_name = "My Site Name"
end
- In your engine's
/lib/blog/engine.rb
set default values like this:
module Blog
self.mattr_accessor :site_name
self.site_name = "Site Name"
# add default values of more config vars here
# this function maps the vars from your app into your engine
def self.setup(&block)
yield self
end
end
- Now you can simply access the config variables in your engine like this:
Blog.site_name
Much cleaner.