App not working in edge rails

My app works fine in Rails 1.1.6 . Now I have put in edge rails in vendor/rails and the app doesn’t start up.

I have following lines in my environment.rb.

include Lindia_main

Lindia_main is in the lib and things work fine in 1.1.6 . But when edge rails is there in the vendor/rails the environment.rb doesn’t pickup that include and I get following message.

./script/…/config/…/vendor/rails/activesupport/lib/active_support/dependencies.rb:267:in `load_missing_constant’: uninitialized constant Lindia_main (NameError)

from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:451:in `const_missing'
from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:463:in `const_missing'

from ./script/../config/../config/environment.rb:5
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:494:in `require'

from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:341:in `new_constants_in'
from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:494:in `require'

from ./script/../config/../vendor/rails/railties/lib/commands/servers/webrick.rb:52
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:494:in `require'

from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:341:in `new_constants_in'
from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:494:in `require'

from ./script/../config/../vendor/rails/railties/lib/commands/server.rb:39
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
from ./script/server:3
from -e:4

Neeraj Kumar wrote:

I have following lines in my environment.rb.

include Lindia_main

Lindia_main is in the lib and things work fine in 1.1.6 . But when edge rails is there in the vendor/rails the environment.rb doesn't pickup that include

I'm not sure that this is it, but I would name the file in your lib folder lindia_main.rb, name the module inside that file module LindiaMain, and then do: include LindiaMain. That should be consistent with the most commonly used naming conventions, which may help find your file. Also, do you have the include after the Rails environment is loaded?

Dan Manges

Hi Dan,

Thanks for the reply. I made the necessary changes. Still no success. I have only one include from lib and that’s not being loaded. The new error message is.

./script/…/config/…/vendor/rails/activesupport/lib/active_support/dependencies.rb:267:in `load_missing_constant’: uninitialized constant LindiaMain (NameError)

from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:451:in `const_missing'
from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:463:in `const_missing'

from ./script/../config/../config/environment.rb:5
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:494:in `require'

from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:341:in `new_constants_in'
from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:494:in `require'

from ./script/../config/../vendor/rails/railties/lib/commands/servers/webrick.rb:52
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:494:in `require'

from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:341:in `new_constants_in'
from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:494:in `require'

from ./script/../config/../vendor/rails/railties/lib/commands/server.rb:39
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
from ./script/server:3
from -e:4

Neeraj Kumar wrote:

Thanks for the reply. I made the necessary changes. Still no success. I have only one include from lib and that's not being loaded. The new error message is.

It must not be finding your module. Try requiring the file:

require File.join(RAILS_ROOT, 'lib', 'lindia_main') include LindiaMain

LindiaMain is a module, correct?

Dan Manges

That solved the problem.

Thank you.

Wishes for a Happy new year.

  • Neeraj