To be clear too, the error message specifically is "The error occurred
while evaluating nil.title" The funny part is that I have the
debug(@document) in the view and it's empty. So it seems like the
instance variable is never made.
As in the second % is missing - not sure what this would do though. It
might be something to do with plural and singulars in the view
directory names confusing the routing, but it wouldn't be able to find
the template at all.
Did you generate with scaffold or rspec_scaffold? If you didn't I'd
suggest generating another entity, say doc, and seeing where the code
differs.
Thanks for the tip about using logger to debug. So I updated my
method in the controller and added a logger call to insert foo and I
didn't see it, which indicated that the action isn't being called.
But from the log files it looks like the action is being called....
Processing DocumentController#new (for 127.0.0.1 at 2007-11-13
20:11:53) [GET]
Session ID: 025b513c214398f0c25466623b80fefa
Parameters: {"action"=>"new", "controller"=>"document"}
Rendering within layouts/application
Rendering document/new
Completed in 0.00449 (222 reqs/sec) | Rendering: 0.00280 (62%) | DB:
0.00000 (0%) | 200 OK [http://localhost/document/new\]
I'm truly puzzled by this. At one point I had a custom route for my
document calss, but I took it out when I though it was a problem Can
routes be cached?
Thanks for point me in the right direction everyone. I figured out
what happened. When I was cutting and pasting some code I
accidentally copied the controller class declaration. So I had a
nest controller declaration.. (e.g.
Class DocumentController < ApplicationController
Class DocumentController < ApplicationController
A lot of code I wrote here...
end
end
I just didn't see the forest for the trees. Thanks again, everyone.