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:in
block in exec_query’ /var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:280:inblock in log' /var/lib/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/notifications/instrumenter.rb:20:in
instrument’ /var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:275:inlog' /var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/sqlite_adapter.rb:242:in
exec_query’ /var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/sqlite_adapter.rb:335:intables' /var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/sqlite_adapter.rb:341:in
table_exists?’ /var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:425:ininitialize_schema_migrations_table' /var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/migration.rb:663:in
initialize’ /var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/migration.rb:570:innew' /var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/migration.rb:570:in
up’ /var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/migration.rb:551:inmigrate' /var/lib/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/railties/databases.rake:153:in
block (2 levels) in <top (required)>’ /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:incall' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in
block in execute’ /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:ineach' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in
execute’ /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:inblock in invoke_with_call_chain' /usr/lib/ruby/1.9.1/monitor.rb:211:in
mon_synchronize’ /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:ininvoke_with_call_chain' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in
invoke’ /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:ininvoke_task' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in
block (2 levels) in top_level’ /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:ineach' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in
block in top_level’ /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:88:in
top_level’ /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:66:inblock in run' /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:63:inrun' /var/lib/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in
<top (required)>’ /usr/local/bin/rake:19:inload' /usr/local/bin/rake:19:in
’ Tasks: TOP => db:migrateThis 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
You need to uncomment the rubyracer to make it work.
Hope this helps.