Note that there are some explanatory texts on larger screens.

plurals
  1. PONoMethodError undefined method '-@' NoMethodError in Controller Ruby on Rails
    primarykey
    data
    text
    <p><strong>Context:</strong> I pulled the most recent code from the repository and tried to make sure that the changes I was about to push up were going to work with that version of the code. This is a Ruby on Rails application. Also worth noting is the fact that when running the main application that I pulled from on the web, this error does not show up. But if I run my branch or the main branch cloned onto my environment, the error always shows up for every url I try. So it is on my end.</p> <p><strong>Problem:</strong> As soon as I go to localhost:3000, I get the following error:</p> <pre><code>NoMethodError in HomeController#index undefined method `-@' for #&lt;ActionDispatch::Response:0x64fd460&gt; </code></pre> <p><strong>What I've Tried:</strong> I have asked my question on the <em>#rubyonrails</em> IRC channel and nobody was able to determine what was going on through the Full Trace (I haven't posted it here because I wasn't sure what was the best way to do that on here; it didn't look very good in the code block or block quote). I have looked at my HomeController's index method, which is defined as such:</p> <pre><code> def index @groups = @current_user.groups @things = Thing.where(:group_id =&gt; @groups.map{|e|e.id}) end </code></pre> <p>I have also Googled around and haven't found what I need to fix the problem.</p> <p><strong>What I've Learned So Far:</strong> -@ is an operator. Some people may receive a similar error in assuming that Ruby has the shortcut to</p> <pre><code> variable = variable + 1 </code></pre> <p>that a lot of other languages have:</p> <pre><code> variable++ </code></pre> <p>Here is an example of that case: <a href="https://stackoverflow.com/q/3548701/1480946">Undefined method `+@&#39; for false:FalseClass (NoMethodError) ruby</a></p> <p><strong>Question:</strong> Does anyone have any further suggestions on how to find the issue here? Also, if I could easily put the Full Trace on here, formatted in an aesthetically pleasing manner, would someone tell me how? I'm at a loss with this one :(</p> <p><strong>Update (2/8/2013):</strong> It seems that the issue does not necessarily reside in the HomeController nor home/index.html.erb View. I have attempted to access ANY url with a valid action and the same error occurs with "NoMethodError in..." changing to the corresponding [...]Controller#index.</p> <p><strong>Update (2/9/2013):</strong> Since this error happens no matter what url I try to navigate to, I decided to look in the routes.rb file in the config folder. I ran my server through rubymine instead of the command line this time, which made it a little easier to read for me. I started looking through all the spit out and I noticed an interested line that consisted of:</p> <pre><code>["private-key looking thing"] [127.0.0.1] Started GET "/" for 127.0.0.1 at 2013-02-09 18:20:52 -0700 </code></pre> <p>It seems like there is a syntactical error in routes.rb (that's my best guess at this point). This does not explain why this only is an issue on my local environment with the same code sets, but what else do I have to go off of?</p> <p>Does anyone have any suggested things to be on the look out for while I sift through this file? Not really sure what to be looking for as far as errors are concerned. Rubymines inspection stuff converted all my double quotes to single quotes and doesn't really have anything else to complain about.</p> <p>Thanks in advance, Jake Smith</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload