LoadError (Expected websites_controller.rb to define WebsitesController)

Hi,

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.

-Ryan

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.
-Conrad

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.

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

ensure there are no syntax errors in websites_controller.rb.

Yeah syntax errors could be a reason

Some time ago I was also facing the same problem, but I also searched on Google and found out a website named Eleggible, you will get its full detail information on this website.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs