3

I am new to ruby. I am simply attempting to set up Devise. I am following the instructions at https://github.com/plataformatec/devise and when I get to the rake db:migrate command, it tells me the rake is aborted and there is "no implicit conversion of nil into String". It's frustrating since I am doing exactly what the guide/videos are doing and I get an error.

See error below.

User$ rake db:migrate
rake aborted!
no implicit conversion of nil into String
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-4.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:24:in `initialize'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-4.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:24:in `new'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-4.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:24:in `sqlite3_connection'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:440:in `new_connection'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:450:in `checkout_new_connection'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:421:in `acquire_connection'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:356:in `block in checkout'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:355:in `checkout'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block in connection'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in `connection'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:546:in `retrieve_connection'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-4.0.0/lib/active_record/connection_handling.rb:79:in `retrieve_connection'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-4.0.0/lib/active_record/connection_handling.rb:53:in `connection'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-4.0.0/lib/active_record/migration.rb:863:in `initialize'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-4.0.0/lib/active_record/migration.rb:764:in `new'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-4.0.0/lib/active_record/migration.rb:764:in `up'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-4.0.0/lib/active_record/migration.rb:742:in `migrate'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activerecord-4.0.0/lib/active_record/railties/databases.rake:42:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

Thank you.

James Chevalier
  • 10,604
  • 5
  • 48
  • 74
Bestinc
  • 71
  • 2
  • 8
  • I'm not certain, so I don't want to suggest this as an answer, but it seems like it could be that you haven't created the database or the connection information in `config/database.yml` isn't present/accurate. – James Chevalier Jul 22 '13 at 19:51

3 Answers3

2

Most likely due to a bad config/database.yml file. Here is a regular one:

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

# 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: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: sqlite3
  database: db/production.sqlite3
  pool: 5
  timeout: 5000
Pierre-Louis Gottfrois
  • 17,561
  • 8
  • 47
  • 71
2

I encountered this same problem, which was caused by the following line in config/initializers/devise.rb:

config.mailer_sender = 'no-reply@' + Rails.application.secrets.domain_name

Rails.application.secrets.domain_name, which is defined in secrets.yml is not set, which was the cause of the error for me.

Daniel Bonnell
  • 4,817
  • 9
  • 48
  • 88
1

Rake was giving me this message every time I tried rake install-ing a gem. It would successfully package the gem, then try to run ruby -S gem install pkg/my_gem.version.gem. It would fail.

Weird thing was, running the command from the command line would successfully install the same gem.

Seeing someone else suggest that all the gems should be reinstalled, I tried just reinstalling the rake gem. It seems to have fixed it. (I also reinstalled the bundler gem, but I don't believe that was the problem).

Bryce Anderson
  • 371
  • 3
  • 8