Project

General

Profile

New to Ruby - undefined method '[]' for false:FalseClass

Added by Chris Peacock over 13 years ago

Hi, I am new to Ruby and Ruby-on-Rails, but I would like to learn. I have read a little but I do best with hands-on experience. I am looking for a issue/bug tracking system for web projects and after a little investigation, I decided to try out Redmine, but I have no knowledge of Ruby or Ruby-on-Rails and I am getting an error. I tried searching but didn't find a specific match here or on Google.

My web site is hosted on HostMonster. I do not know much about the Ruby/ROR environment I am in, and the "RAILS_ENV=production script/about" command has an error (listed below), but here is what I have gathered:

Ruby version 1.8.7
Rails version 2.3.5
Operating system Linux (x86_64)
Kernel version 2.6.28-10.40.intel.E1000E.BHsmp
Apache version 2.2.15
Ruby-aware server used Unknown, assuming Webrick, but Mongrel gems are installed
Active Record version 2.3.5
Action Pack version 2.3.5
Active Resource version 2.3.5
Action Mailer version 2.3.5
Active Support version 2.3.5
Application root /home/thegadgi/rails_apps/redmine
Environment production
Database adapter mysql (5.1.47-community-log)
Rack version 1.0.1
Rake version 0.8.7

There are other Gems already installed by HostMonster too, I can list them all if needed.

I have created the Ruby-on-Rails app in cPanel and followed the instructions at HostGator here, but I am getting this error when I run RAILS_ENV=production rake db:migrate --trace:

** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
undefined method `[]' for false:FalseClass
/home1/thegadgi/rails_apps/redmine/vendor/rails/activerecord/lib/active_record/connection_adapteection'
/home1/thegadgi/rails_apps/redmine/vendor/rails/activerecord/lib/active_record/connection_adapteection'
/home1/thegadgi/rails_apps/redmine/config/../vendor/rails/railties/lib/initializer.rb:438:in `in
/home1/thegadgi/rails_apps/redmine/config/../vendor/rails/railties/lib/initializer.rb:141:in `pr
/home1/thegadgi/rails_apps/redmine/config/../vendor/rails/railties/lib/initializer.rb:113:in `se
/home1/thegadgi/rails_apps/redmine/config/../vendor/rails/railties/lib/initializer.rb:113:in `ru
/home1/thegadgi/rails_apps/redmine/config/environment.rb:20
/usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/home1/thegadgi/rails_apps/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb
/home1/thegadgi/rails_apps/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb
/home1/thegadgi/rails_apps/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb
/home1/thegadgi/rails_apps/redmine/vendor/rails/railties/lib/tasks/misc.rake:4
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/usr/lib64/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/usr/lib64/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

Here is the error I get when running RAILS_ENV=production script/about:

./script/../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:119:Warning: 
Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010.  
Use #requirement
/home1/thegadgi/rails_apps/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters
/abstract/connection_specification.rb:59:in `establish_connection': undefined method `[]' for 
false:FalseClass (NoMethodError)
        from /home1/thegadgi/rails_apps/redmine/vendor/rails/activerecord/lib/active_record
/connection_adapters/abstract/connection_specification.rb:55:in `establish_connection'
        from ./script/../config/../vendor/rails/railties/lib/initializer.rb:438:in 
`initialize_database'
        from ./script/../config/../vendor/rails/railties/lib/initializer.rb:141:in `process'
        from ./script/../config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
        from ./script/../config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
        from /home1/thegadgi/rails_apps/redmine/config/environment.rb:20
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /home1/thegadgi/rails_apps/redmine/vendor/rails/railties/lib/commands/about.rb:1
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from script/about:4

Any help here would be greatly appreciated.


Replies (4)

RE: New to Ruby - undefined method '[]' for false:FalseClass - Added by Chris Peacock over 13 years ago

Thanks for responding. Here's the config/database.yml:

# MySQL (default setup).

production:
  adapter: mysql
  database: thegadgi_redmine
  host: localhost
  username: thegadgi_redmine
  password: [HIDDEN]
  encoding: utf8

development:
  adapter: mysql
  database: redmine_development
  host: localhost
  username: root
  password:
  encoding: utf8

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: mysql
  database: redmine_test
  host: localhost
  username: root
  password:
  encoding: utf8

test_pgsql:
  adapter: postgresql
  database: redmine_test
  host: localhost
  username: postgres
  password: "postgres" 

test_sqlite3:
  adapter: sqlite3
  database: db/test.db

RE: New to Ruby - undefined method '[]' for false:FalseClass - Added by Felix Schäfer over 13 years ago

Mmh, I can't find anything bad in there, other than I'm not sure how good yml handles keys with empty values… Try commenting out everything but the production environment.

RE: New to Ruby - undefined method '[]' for false:FalseClass - Added by Chris Peacock over 13 years ago

Commented everything out but the production environment, but still the same errors. I will also see if I can get some help from the web host, HostMonster, maybe they can shed some light on the issue.

    (1-4/4)