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.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
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 :-) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. On Mar 20, 8:52 pm, Ruby Freak <twscann...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> When I create a new 2.0 project (rails project_name) > Aptana shows what appears to me to be a valid error inboot.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.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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.
On Mar 24, 1:22 pm, Ruby Freak
<twscann...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> 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.
>
> On Mar 20, 8:52 pm, Ruby Freak
<twscann...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > When I create a new 2.0 project (rails project_name)
> > Aptana shows what appears to me to be a valid error inboot.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.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Seemingly Similar Threads
- Re: [Rails-core] Re: (Unable to start rails application) ruby scipt/server error
- (Unable to start rails application) ruby scipt/server error
- Restful Authentication Uninitialized Constant in Production...
- no such file to load -- ferret
- Weird Issue with Rails 2.0.2+???