Question about the Inspector not seing an Array in the Conroller

Hello,

RubyMine:  2.0.2

Rails:  2.3.5

Code:   Following the Head First Rails book, page 182

I've noticed the inspector fail to find an object a couple of times.    I was just curious if there's something I don't understand or a way to force the inspector to see what it's missing?   While inside the "find" method of the "client_workouts" controller, RubyMine does understand what the associated view is so I'm not seeing why the inspector doesn't pick up on the "@client_workouts" object in the Find method.

Thanks!

Untitled.png

6 comments
Comment actions Permalink

Reno,

Could you try our RubyMine 3.0 RC (see http://blogs.jetbrains.com/ruby/2010/11/rubymine-3-0-release-candidate-—-last-minute-little-fixes/) ?  Stable RubyMine 2.0.2 is quite out of date.

0
Comment actions Permalink

Hi Roman,

The Code Inspector in 3.0 (analyzing the project from scratch on startup) has the same issue (screenshots would look identical).    I also tried creating a new global variable in the Find method of the controller.   In the find view, the code inspector didn't recognize the new global variable either.  I'm still pretty new to Rails so pardon me if I'm doing something stupid.   I attached a zipped copy of the project if it helps.  

Controller:  \client_workouts\app\controllers\client_workouts_controller.rb
Controller Method:  find
View:   \client_workouts\app\views\client_workouts\find.html.erb
Variable in the find view not being seen as existing by the Inspector:  @client_workouts

Thanks!



Attachment(s):
client_workouts.zip
0
Comment actions Permalink

Reno,

It's because you defined 2 methods "find"


  def find
    puts params[:search_string]
  end

  def find
    @client_workouts = ClientWorkout.find(:all, :conditions=>["client_name = ? OR trainer = ?",
                                          params[:search_string], params[:search_string]])
  end

due to some bug RubyMine scans for defined instance variable only in first declaration but obviously the second method overrides first one. If you comment first method all will work as expected.

Please file a bug report at http://youtrack.jetbrains.net/issues/ruby

0
Comment actions Permalink

Wow, sorry about that.    That's crazy I didn't notice the other method.

Will do on the bug report.    Seems like it would be a nice thing for the Inspector to point out something like two methods of the same name in a controller too (for slow people like me anyway).

Thanks for your time!   

0
Comment actions Permalink

Screen shot 2010-11-16 at 1.50.38 AM.png
RubyMine shows to clicable gutters, see screenshot.

0
Comment actions Permalink

I never bothered to lookup what those gutter symbols were, pardon.  That's awesome.

Thanks for all the help, I really appreciate it!

0

Please sign in to leave a comment.