NoMethodError with rake db:migrate

Hi! First of all, this is my first application on Rails, and i’m stuck
at a
migration. i created a demo app (the demo_app from michael hartl’s
tutorial) as usual: rails new demo_app, rails generate scaffold User
name:string email:string, and when i do rake db:migrate, this stack
appears:

rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
rake aborted!
NoMethodError: undefined method to_a' for #<SQLite3::Statement:0x9d6a2dc>: SELECT name FROM sqlite_master WHERE type = 'table' AND NOT name = 'sqlite_sequence' AND name = "schema_migrations" /var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/sqlite_adapter.rb:248:inblock in exec_query’
/var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:280:in
block in log' /var/lib/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/notifications/instrumenter.rb:20:ininstrument’
/var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:275:in
log' /var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/sqlite_adapter.rb:242:inexec_query’
/var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/sqlite_adapter.rb:335:in
tables' /var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/sqlite_adapter.rb:341:intable_exists?’
/var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:425:in
initialize_schema_migrations_table' /var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/migration.rb:663:ininitialize’
/var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/migration.rb:570:in
new' /var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/migration.rb:570:inup’
/var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/migration.rb:551:in
migrate' /var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/railties/databases.rake:153:inblock (2 levels) in <top (required)>’
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in call' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:inblock in
execute’
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in each' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:inexecute’
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in block in invoke_with_call_chain' /usr/lib/ruby/1.9.1/monitor.rb:211:inmon_synchronize’
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in
invoke_with_call_chain' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:ininvoke’
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in
invoke_task' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:inblock
(2 levels) in top_level’
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in
each' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:inblock
in top_level’
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in
standard_exception_handling' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:88:intop_level’
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:66:in
block in run' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:instandard_exception_handling’
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in
run' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in<top (required)>’
/usr/local/bin/rake:19:in load' /usr/local/bin/rake:19:in
Tasks: TOP => db:migrate

This is the Gemfile:

source ‘https://rubygems.org

gem ‘rails’, ‘3.2.8’

Bundle edge Rails instead:

gem ‘rails’, :git => ‘git://github.com/rails/rails.git’

gem ‘sqlite3’
gem ‘sqlite3-ruby’, ‘1.2.5’, :require => ‘sqlite3’

Gems used only for assets and not required

in production environments by default.

group :assets do
gem ‘sass-rails’, ‘~> 3.2.3’
gem ‘coffee-rails’, ‘~> 3.2.1’

See https://github.com/sstephenson/execjs#readme for more supported

runtimes

gem ‘therubyracer’, :platforms => :ruby

gem ‘uglifier’, ‘>= 1.0.3’
end

gem ‘jquery-rails’

To use ActiveModel has_secure_password

gem ‘bcrypt-ruby’, ‘~> 3.0.0’

To use Jbuilder templates for JSON

gem ‘jbuilder’

Use unicorn as the app server

gem ‘unicorn’

Deploy with Capistrano

gem ‘capistrano’

To use debugger

gem ‘debugger’

Any pointer to something i missed, or something wrong, will be highly
appreciated. If you need any additional info in order to help, please
ask,
:)a

On 18 September 2012 04:00, jose ramirez [email protected] wrote:

** Execute db:load_config

source ‘https://rubygems.org

gem ‘rails’, ‘3.2.8’

Bundle edge Rails instead:

gem ‘rails’, :git => ‘git://github.com/rails/rails.git’

gem ‘sqlite3’
gem ‘sqlite3-ruby’, ‘1.2.5’, :require => ‘sqlite3’

Are those the versions of rails (3.2.8) and sqlite3-ruby that the
tutorial expects? I don’t know but I suspect that a later version of
sqlite3-ruby might fix it. Googling for the error message finds this
for example
http://stackoverflow.com/questions/8604360/rails-3-rake-dbmigrate-fails-with-a-rake-aborted-cant-convert-sqlite3state

Colin

On Tuesday, September 18, 2012 8:30:54 AM UTC+5:30, jose ramirez wrote:

** Invoke db:load_config (first_time)

/var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:280:in

`table_exists?’

/var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/railties/databases.rake:153:in

`invoke_with_call_chain’
/var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:88:in

gem ‘sqlite3-ruby’, ‘1.2.5’, :require => ‘sqlite3’

You need to uncomment the rubyracer to make it work.
Hope this helps.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs