I am getting the following in my log file upon loading /login/.
Started GET \"/login\" for 120.138.93.108 at 2016-01-02 03:06:24 +0000
Act
I solved this issue by re-creating helpers/sessions_helper.rb (using touch) and filling it with the exact same contents. Weird, but it worked.
I had a similar problem:
Couldn't find AgileTeamsHelper, expected it to be defined in helpers/agile_teams_helper.rb
It turns out I had this defined in my helper:
module AgileTeamHelper
def td_color(text)
if text == "Green"
"green-background"
elsif text == "Yellow"
"yellow-background"
elsif text == "Red"
"red-background"
end
end
end
Instead of:
module AgileTeamsHelper # <-- (Notice the extra s after teams)
def td_color(text)
if text == "Green"
"green-background"
elsif text == "Yellow"
"yellow-background"
elsif text == "Red"
"red-background"
end
end
end
In this case I was missing the 's' in 'AgileTeamsHelper'. I believe that rails looks for a module with the same as the helper, but camel cased. IE. 'agile_teams_helper'.camelize
-> "AgileTeamsHelper"
I simply followed the age-old advice:
when in doubt, restart your server
and that was enough for me. I was absolutely sure the code was alright.
In my case, I had an :
include ModuleName
pointing to a non existing module in a model. This one has been previously removed but I had miss the reference.
I had the exact same "Couln't find ..." error with every helpers I have in my app so it was pretty difficult to find out where the problem came from.
Sometimes it's not the problem of helpers. Delete all the helpers and see what happens next.
It seems if the loading (reading the class file, eval the content to define the class/module defined inside) of the controller itself fails with whatever reason, it shows this error.
In my case, there was a class from a gem which was intended to be used by include
ing to the controller, which overrides included
method, and did some initialization process. The problem was, this include
method raised an exception, which prevented the Controller to get loaded, and I don't know why but resulted in a situation just like as described in this question.
I found out the root cause by deleting all the helpers and checking what happens next. If error changes and you find it to be happening on the loading of the Controller, then now you can fix it.
# Example class of what have caused the Helper not found in my case
class FooController
include SomeGemWhichRaiseExceptionOnInclude
end