I am working on a Gem for Rails 3 apps. In it, I want to include
another GEM/lib/app/config/routes.rb to have gem level access to add
new routes non programmatically. i.e., not runtime generated.
During Gem initialization I am adding the gem’s lib/app/config dir to
$LOAD_PATH and AS’s Dependencies module like so.
path = File.join(Rails.root, ‘/vendor’, ‘sitecontrol’, ‘lib’,
‘sitecontrol’, ‘app’, ‘config’)
$LOAD_PATH << path
ActiveSupport::Dependencies.load_paths << path
Outputting $LOAD_PATH is showing that the gem’s lib/app/config dir has
GEM/lib/app/config/routes.rb looks like this.
SitecontrolIntegrationEnv::Application.routes.draw do |map|
match ‘login’, :to => ‘user_sessions#new’
When running my specs I get “undefined local variable or method
`login_path’”. If I add the same route to Rails’ standard RAILS/app/
config/routes.rb the spec will pass.
How can I go about adding routes in this way from my gem lib?
Thanks so much.