Welcome Guest | Login

Error - Expected x to define y (x and y can be controller or model)



This is a wiki article created by HostingRails users. Please login or signup to make edits.


This error message can be found in the production log (usually combined with an error in the browser indicating an application error).  A simple, albeit imperfect solution is to try the following:

1. Log in via SSH to your server and go your app directory.

2. Open the console and call the erroneous controller/model:
[~/yourapp] script/console -e production
Loading production environment
[>>] RecordsController
[>>] Record
Of course, you'll want to call the model or controller that is giving you the error message, as appropriate.

3. If it returns the value of what you entered, that's fine.  Go ahead and exit the console and stop, then start the mongrel server.  (It seems to work better in this instance to stop, then start, instead of using the mongrel_rails restart command).

4. Go check out your log and reload the page.

Hope that helps,
-Justus

"



Hello Guest! In order to edit this article you must be an active client with us, please log in or sign up today!






Contributing Author(s):
Marketpt