views:

226

answers:

2

I am writing a rails app, which has some modules and methods loaded via the lib directory, we have also added some methods in restful authentication module, now everytime when i run using mongrel server on production i dont get this error, although because model classes and controller classes are cached, but in development i do get this error, after the first time, so i start my server on development and run once i get the correct behavior, but when i refresh the page i get this nil.include error, while it displays that the each method is getting a nil to iterate, also i have done some homework, as i added the puts method, for all methods for that instance while iterating, i dont get any method definations for attributes of the table, like ID, name, title. i am unsure about this,

I am using Rails 2.2.2 and ruby 1.8.7. Server is mongrel & webrick.

+1  A: 

You should look into the log/development.log or log/production.log files (depending on the environment you are investigating). The first line of the stacktrace shows the source of the error. Try to find the error there or post the relevant line (this and some above).

bb
+1  A: 

This situation happened to me, where I used to get the error only after the refresh (i.e., second call to the server).

It may be that you have defined a module in your /lib directory which does not matches the rails convention of file-naming. And you are using the require "filename.rb" statement to get the module.

Try using require_dependency "filename.rb" instead.

Let me know if problem still exists, we may look deeper.

Vikrant Chaudhary
I suppose this can be probable answer to my question, can you please add more details like, what kind of file names are not allowed.
T.Raghavendra
hey I tried setting require_dependency but not resolving the issue, at first glance it loads everything properly but in second time, after refresh i get method_missing error.I have tried loading all files from lib before server startup.
T.Raghavendra
Can you please provide the name of the classes and file-names? A stack of error will be helpful too.Open `script/console` and run"lib/" + "Module::ClassName".underscoreto know what the the file-name should be for a class or module.
Vikrant Chaudhary
hey i suppose, that solved the issue.. thanks a lot, i was lacking some relationship attributes with user refernces, i have fixed and its working fine thanks.
T.Raghavendra