Context: I pulled the latest code from the repository and tried to make sure that the changes I was about to push would work with this version of the code. This is a Ruby on Rails application. It is also worth noting the fact that when I launch the main application that I pulled from the Internet, this error does not appear. But if I run my branch or the main branch cloned into my environment, an error always appears for every URL that I am trying to execute. So this is at my end.
Problem: As soon as I switch to localhost: 3000, I get the following error:
NoMethodError in HomeController#index undefined method ` -@ ' for #<ActionDispatch::Response:0x64fd460>
What I tried: I asked my question on the IRC channel # rubyonrails, and no one could determine what was going on through Full Trace (I did not post it here because I was not sure if this was the best way to do it here; it didnβt look very good in code block or block). I looked at my HomeController index method, which is defined as such:
def index @groups = @current_user.groups @things = Thing.where(:group_id => @groups.map{|e|e.id}) end
I also googled around and did not find what I needed to solve the problem.
What I learned so far: - @ - operator. Some people might get a similar error, assuming Ruby has a shortcut to
variable = variable + 1
that many other languages ββhave:
variable++
Here is an example of this case: Undefined `+ @ 'method for false: FalseClass (NoMethodError) ruby
Question: Does anyone have any further suggestions on how to find the problem here? Also, if I could easily turn on Full Trace here, formatted in an aesthetically pleasing manner, would someone tell me how to do this? I'm in trouble with this :(
Update (2/8/2013): It seems that the problem is not necessarily found in the HomeController and home / index.html.erb View. I tried to access ANY url with a valid action, and with the error "NoMethodError in ..." with the same error, the transition to the corresponding index [...] Controller # occurs.
Update (2/9/2013): Since this error occurs no matter what url I try to go to, I decided to look in the routes.rb file in the config folder. This time I started my server through Rubyin instead of the command line, which made it a little easier to read for me. I started looking through all the words, and I noticed an interesting line consisting of:
["private-key looking thing"] [127.0.0.1] Started GET "/" for 127.0.0.1 at 2013-02-09 18:20:52 -0700
There seems to be a syntax error in routes.rb (this is my best guess at this point). This does not explain why this is only a problem in my local environment with the same sets of code, but what else do I need to get away?
Does anyone have any suggested things to keep abreast while I sift this file? Not quite sure what to look for regarding errors. Rubymines inspection materials turned all of my double quotes into single quotes and really don't have anything else to complain about.
Thanks in advance, Jake Smith