Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

boot.rb accidental assignment?

#2701

I am using Rails 2.3.2. with NetBeans IDE 6.5.1. The following message shows in the Task List Window.

Accidental assignment? (if x = y instead of x ==y) for boot.rb line 59

Looking at boot.rb:

    def load_rails_gem

  if version = self.class.gem_version
    gem 'rails', version
  else
    gem 'rails'
  end</code>



Should the if line be this?

      if version == self.class.gem_version

Thanks,
Tom

Reported by tomraider · May 23rd, 2009 @ 10:57 PM

State: invalid
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Nobuhiro IMAI
    Nobuhiro IMAI

    This is intentional, I guess.

    Variable assignment is evaluated as expression, and have its
    assigned value all the time. It seems there is no method named
    version(), so useing == here will raise the NameError. A version
    here is local variable to cache the result of
    self.class.gem_version, and pass it to gem() method as second
    argument if that is not nil (nor false).

    May 24th, 2009 @ 12:27 AM

  2. Jeremy Kemper
    Jeremy Kemper
    • State changed from new to invalid

    May 24th, 2009 @ 05:51 AM