LoadError (Expected websites_controller.rb to define WebsitesController)


I just removed all my RoR files on my web server and re uploaded them again because I made so many changes to my application. Now all of a sudden, I'm getting the LoadError (Expected websites_controller.rb to define WebsitesController). But this is the first line of my websites_controller.rb:

class WebsitesController < ApplicationController

Any ideas why I might be getting such a crazy error? My application worked fine in the past.


And occasionally I get other impossibly unhelpful errors:

uninitialized constant ApplicationController undefined method `getwebsite' for ApplicationController:Class no route found to match "/javascripts/prototype.js" with {:method=>:get}

Actually, the error just gets worse for no reason. Now it won't find my "getwebsite" function.

My application does: include ApplicationHelper

and ApplicationHelper has: def getwebpage     id = (params[:id].nil? ? "homepage" : params[:id])     @webpage = $website.WebPages.find_by_long_id(id)     return @webpage   end

But I still get undefined local variable or method `getwebsite' for ApplicationController:Class.

Hi, you’re calling getwebsite somewhere but you have defined method called getwebpage. Thus, are these to names refer to same code or different code? Also, is everything working locally? If not, then your wasting your time deploying.


Ah, sorry I copied the wrong one. I also have:   def getwebsite     sitename = request.host_with_port     sitename = "www." + sitename unless sitename.split('.')[2]     $website = Website.find_by_title( sitename )   end

defined in my Application Helper. Its not working locally either.... but the thing is I HAVE defined that. Evil machine.

ensure there are no syntax errors in websites_controller.rb.

you have instance getwebsite method, while error telling you there is no class method with this name. how and where getwebsite is called?