# Error in new project boot.rb

**URL:** <https://www.ruby-forum.com/t/error-in-new-project-boot-rb/132535>\
**Category:** Rails\
**Created:** [March 21, 2008, 4:54am UTC](https://www.ruby-forum.com/t/error-in-new-project-boot-rb/132535 "2008-03-21T04:54:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubyfreak](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9c0ed/32.png) [@rubyfreak](https://www.ruby-forum.com/u/rubyfreak)\
**Post date:** [March 21, 2008, 4:54am UTC](https://www.ruby-forum.com/t/error-in-new-project-boot-rb/132535/1 "2008-03-21T04:54:07Z")

</div>

When I create a new 2.0 project (rails project\_name)  
Aptana shows what appears to me to be a valid error in boot.rb

The line:

if version = self.class.gem\_version

is an assignment  
Should this not read:

if version == self.class.gem\_version

def load\_rails\_gem  
if version = self.class.gem\_version  
gem ‘rails’, version  
else  
gem ‘rails’  
end  
rescue Gem::LoadError =\> load\_error  
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS\_GEM\_VERSION setting in  
config/environment.rb for the Rails version you do have installed, or  
comment out RAILS\_GEM\_VERSION to use the latest version installed.)  
exit 1  
end

There is also a second error reported in the (rescue Gem::LoadError =\>  
load\_error) of “unused local variable load\_error”

I changed the first problem to ==, but I am not sure what to do about  
the second.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![rubyfreak](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9c0ed/32.png) [@rubyfreak](https://www.ruby-forum.com/u/rubyfreak)\
**Post date:** [March 21, 2008, 10:20am UTC](https://www.ruby-forum.com/t/error-in-new-project-boot-rb/132535/2 "2008-03-21T10:20:28Z")

</div>

Hi,

You don’t have to change anything.  
you can read “if version = self.class.gem\_version”  
as “if (version = self.class.gem\_version) != nil”

For the second issue, you could just delete the “=\> load\_error” part,  
but I wouldn’t bother, I won’t waste my time on every little warning  
your IDE is giving you 🙂

---

<div class="post-metadata">

**Author:** ![rubyfreak](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9c0ed/32.png) [@rubyfreak](https://www.ruby-forum.com/u/rubyfreak)\
**Post date:** [March 24, 2008, 9:23pm UTC](https://www.ruby-forum.com/t/error-in-new-project-boot-rb/132535/3 "2008-03-24T21:23:09Z")

</div>

OK,

I am now confused.  
You are saying that the statement

“if version = self.class.gem\_version” is testing whether the  
assignment was successful?

Could someone please explain this?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![rubyfreak](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9c0ed/32.png) [@rubyfreak](https://www.ruby-forum.com/u/rubyfreak)\
**Post date:** [March 24, 2008, 10:57pm UTC](https://www.ruby-forum.com/t/error-in-new-project-boot-rb/132535/4 "2008-03-24T22:57:43Z")

</div>

Actually, I get it now.

A) It IS an assignment AND a test.  
B) It is written in a compact and confusing manner.

It should say: (well at least it would more easily understood 🙂

def load\_rails\_gem  
version = self.class.gem\_version # an assignment  
if version # a test  
gem ‘rails’, version  
else  
gem ‘rails’  
end

Thanks again.
