A Rails 3 centric Gem with it's own routes.rb?

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
ActiveSupport::Dependencies.load_once_paths.delete(path)

Outputting $LOAD_PATH is showing that the gem’s lib/app/config dir has
been added.

GEM/lib/app/config/routes.rb looks like this.

SitecontrolIntegrationEnv::Application.routes.draw do |map|
match ‘login’, :to => ‘user_sessions#new’
end

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.
Elliott G

Any thoughts on this one guys?

I solved the problem.

I was assuming that since I was duplicating the standard Rails dir
structure in my gem that Rails would load files automatically if their
parent dir was on $LOAD_PATH. I was wrong. From now on, I will only
assume that Rails is loading only one file automatically (rails/
init.rb).

My gem is called Sitecontrol… I just added a require ‘sitecontrol/
config/routes’ from my gem’s initial lib file (sitecontrol.rb) to the
extra routes.rb file I added.