This project is archived and is in readonly mode.

#2701 ✓invalid
tomraider

boot.rb accidental assignment?

Reported by tomraider | May 23rd, 2009 @ 10:57 PM | in 2.x

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

Comments and changes to this ticket

  • Nobuhiro IMAI

    Nobuhiro IMAI May 24th, 2009 @ 12:27 AM

    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).

  • Jeremy Kemper

    Jeremy Kemper May 24th, 2009 @ 05:51 AM

    • State changed from “new” to “invalid”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Tags

Pages