I'm following the RoR Getting Started tutorial. Having created posts, I'm now adding the second model to create comments. However, when I try rake db:migrate I get this:
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:migrate
== CreateComments: migrating =================================================
-- create_table(:comments)
rake aborted!
An error has occurred, this and all later migrations canceled:
undefined method `reference' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x1084a24d8>
/Users/Fryed/rails/blog/db/migrate/20120710225337_create_comments.rb:6:in `change'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/schema_statements.rb:160:in `create_table'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:466:in `send'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:466:in `method_missing'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:438:in `say_with_time'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:438:in `say_with_time'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:458:in `method_missing'
/Users/Fryed/rails/blog/db/migrate/20120710225337_create_comments.rb:3:in `change'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:407:in `migrate'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:407:in `migrate'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:123:in `with_connection'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:389:in `migrate'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:528:in `__send__'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:528:in `migrate'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:720:in `migrate'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:775:in `call'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:775:in `ddl_transaction'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/transactions.rb:208:in `transaction'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:775:in `ddl_transaction'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:719:in `migrate'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:700:in `each'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:700:in `migrate'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:570:in `up'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/migration.rb:551:in `migrate'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.6/lib/active_record/railties/databases.rake:153
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/bin/rake:33
/usr/bin/rake:23:in `load'
/usr/bin/rake:23
Tasks: TOP => db:migrate
I'm running:
Rake 0.9.2.2.
Ruby 1.8.7
Rails 3.2.6
Migrations with references use the references helper, you probably just forgot to put the s in the end.
Find the offending migration db/migrate/20120710225337_create_comments.rb and change from reference to references
Related
I was trying to get my project working on Heroku but when I was trying to run "rake db:migrate" got the following
any idea????
Thanks :)
P.D: I think the probles is here
** Execute db:schema:dump
rake aborted!
Because
Rake tasks that write to disk, such as rake db:schema:dump, are not compatible with Heroku’s ephemeral filesystem.
PS C:\Users\siel3\Documents\nimbus> heroku run rake db:migrate --trace
Running `rake db:migrate --trace` attached to terminal... up, run.6524
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
** Invoke db:_dump (first_time)
** Execute db:_dump
** Invoke db:schema:dump (first_time)
** Invoke environment
** Invoke db:load_config
** Execute db:schema:dump
rake aborted!
Errno::ENOENT: No such file or directory - /app/db/schema.rb
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/railties/databases.rake:243:in `initialize'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/railties/databases.rake:243:in `open'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/railties/databases.rake:243:in `block (3 levels)
in <top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/app/vendor/ruby-2.0.0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/railties/databases.rake:50:in `block (2 levels)
in <top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/app/vendor/ruby-2.0.0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/railties/databases.rake:45:in `block (2 levels)
in <top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/app/vendor/ruby-2.0.0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/bin/rake:23:in `load'
/app/vendor/bundle/ruby/2.0.0/bin/rake:23:in `<main>'
Tasks: TOP => db:schema:dump
Do you not have a db/schema.rb file in your application? That file should be in ApplicationName/db/schema.rb If this is your first upload to heroku maybe try to run rake db:seed first to create the schema file, then do your migrations after.
The problem was Windows...
Windows rename the /db folder as /DB, and heroku breaks if this happens.
I'm trying to follow along on this tutorial and can't get past the setup of pg.
https://shellycloud.com/blog/2013/10/adding-search-and-autocomplete-to-a-rails-app-with-elasticsearch
I set up pg on my computer using the postgres app, and I installed it successfully in my app using bundle install, but whenever I run rake db:seed I get the error below. pg is running on port 5432, I've tried uninstalling and installing again. rails server runs fine, and psql is working in the terminal.
I have been searching for hours and can't find anything that can explain what the issue is - most answers are to do with sunspot solr which I'm not using. I have already increased my system's shared memory as advised in the postgres app documentation:
sudo sysctl -w kern.sysv.shmall=65536
sudo sysctl -w kern.sysv.shmmax=16777216
I added the following to my development config as another answer mentioned this as a potential solution:
config.action_mailer.perform_deliveries = false
Any help would be very much appreciated!
This is the error I get when I run rake db:seed
michaels-air:bookstore_search michaeltaylor$ rake db:seed --trace
** Invoke db:seed (first_time)
** Execute db:seed
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
rake aborted!
Connection refused - connect(2)
/Users/michaeltaylor/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/net/http.rb:878:in `initialize'
/Users/michaeltaylor/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/net/http.rb:878:in `open'
/Users/michaeltaylor/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/net/http.rb:878:in `block in connect'
/Users/michaeltaylor/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
/Users/michaeltaylor/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/net/http.rb:877:in `connect'
/Users/michaeltaylor/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
/Users/michaeltaylor/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/net/http.rb:851:in `start'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rest-client-1.6.7/lib/restclient.rb:72:in `post'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/tire-0.6.0/lib/tire/http/client.rb:19:in `post'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/tire-0.6.0/lib/tire/index.rb:146:in `store'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/tire-0.6.0/lib/tire/model/search.rb:148:in `block in update_index'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:373:in `_run__4090249372457318285__update_elasticsearch_index__callbacks'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:80:in `run_callbacks'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/tire-0.6.0/lib/tire/model/search.rb:144:in `update_index'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/tire-0.6.0/lib/tire/model/callbacks.rb:21:in `block in included'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:386:in `_run__4090249372457318285__save__callbacks'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:80:in `run_callbacks'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/callbacks.rb:299:in `create_or_update'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/persistence.rb:106:in `save'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/validations.rb:51:in `save'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/attribute_methods/dirty.rb:32:in `save'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/transactions.rb:270:in `block (2 levels) in save'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/transactions.rb:326:in `block in with_transaction_returning_status'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `block in transaction'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:210:in `within_new_transaction'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `transaction'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/transactions.rb:209:in `transaction'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/transactions.rb:323:in `with_transaction_returning_status'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/transactions.rb:270:in `block in save'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/transactions.rb:281:in `rollback_active_record_state!'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/transactions.rb:269:in `save'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/persistence.rb:37:in `create'
/Users/michaeltaylor/Codes/bookstore_search/db/seeds.rb:19:in `block in <top (required)>'
/Users/michaeltaylor/Codes/bookstore_search/db/seeds.rb:18:in `each'
/Users/michaeltaylor/Codes/bookstore_search/db/seeds.rb:18:in `<top (required)>'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `block in load'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.0/lib/rails/engine.rb:540:in `load_seed'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/tasks/database_tasks.rb:153:in `load_seed'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/railties/databases.rake:181:in `block (2 levels) in <top (required)>'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/task.rb:236:in `call'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/task.rb:231:in `each'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/Users/michaeltaylor/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/application.rb:106:in `each'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/application.rb:106:in `block in top_level'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/application.rb:78:in `block in run'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/bin/rake:23:in `load'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/bin/rake:23:in `<main>'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `eval'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:seed
This is my config yml
development:
adapter: postgresql
encoding: unicode
database: bookstore_development
pool: 5
username: michaeltaylor
password:
# Connect on a TCP socket. Omitted by default since the client uses a
# domain socket that doesn't need configuration. Windows does not have
# domain sockets, so uncomment these lines.
host: localhost
This is what I get if I try and run rake db:setup
michaels-air:bookstore_search michaeltaylor$ rake db:setup --trace
** Invoke db:setup (first_time)
** Invoke db:schema:load_if_ruby (first_time)
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:create
bookstore_development already exists
bookstore_test already exists
** Invoke environment (first_time)
** Execute environment
** Execute db:schema:load_if_ruby
** Invoke db:schema:load (first_time)
** Invoke environment
** Invoke db:load_config
** Execute db:schema:load
-- enable_extension("plpgsql")
-> 0.0194s
-- create_table("authors", {:force=>true})
-> 0.0214s
-- create_table("authors_books", {:force=>true})
-> 0.0075s
-- create_table("books", {:force=>true})
-> 0.0123s
-- create_table("books_subjects", {:force=>true})
-> 0.0082s
-- create_table("subjects", {:force=>true})
-> 0.0092s
-- initialize_schema_migrations_table()
-> 0.0029s
** Invoke db:structure:load_if_sql (first_time)
** Invoke db:create
** Invoke environment
** Execute db:structure:load_if_sql
** Invoke db:seed (first_time)
** Execute db:seed
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment
** Execute db:abort_if_pending_migrations
rake aborted!
Connection refused - connect(2)
/Users/michaeltaylor/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/net/http.rb:878:in `initialize'
/Users/michaeltaylor/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/net/http.rb:878:in `open'
/Users/michaeltaylor/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/net/http.rb:878:in `block in connect'
/Users/michaeltaylor/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
/Users/michaeltaylor/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/net/http.rb:877:in `connect'
/Users/michaeltaylor/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
/Users/michaeltaylor/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/net/http.rb:851:in `start'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rest-client-1.6.7/lib/restclient.rb:72:in `post'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/tire-0.6.0/lib/tire/http/client.rb:19:in `post'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/tire-0.6.0/lib/tire/index.rb:146:in `store'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/tire-0.6.0/lib/tire/model/search.rb:148:in `block in update_index'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:373:in `_run__1365093858615832810__update_elasticsearch_index__callbacks'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:80:in `run_callbacks'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/tire-0.6.0/lib/tire/model/search.rb:144:in `update_index'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/tire-0.6.0/lib/tire/model/callbacks.rb:21:in `block in included'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:386:in `_run__1365093858615832810__save__callbacks'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:80:in `run_callbacks'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/callbacks.rb:299:in `create_or_update'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/persistence.rb:106:in `save'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/validations.rb:51:in `save'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/attribute_methods/dirty.rb:32:in `save'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/transactions.rb:270:in `block (2 levels) in save'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/transactions.rb:326:in `block in with_transaction_returning_status'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `block in transaction'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:210:in `within_new_transaction'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `transaction'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/transactions.rb:209:in `transaction'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/transactions.rb:323:in `with_transaction_returning_status'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/transactions.rb:270:in `block in save'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/transactions.rb:281:in `rollback_active_record_state!'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/transactions.rb:269:in `save'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/persistence.rb:37:in `create'
/Users/michaeltaylor/Codes/bookstore_search/db/seeds.rb:19:in `block in <top (required)>'
/Users/michaeltaylor/Codes/bookstore_search/db/seeds.rb:18:in `each'
/Users/michaeltaylor/Codes/bookstore_search/db/seeds.rb:18:in `<top (required)>'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `block in load'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/railties-4.0.0/lib/rails/engine.rb:540:in `load_seed'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/tasks/database_tasks.rb:153:in `load_seed'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.0/lib/active_record/railties/databases.rake:181:in `block (2 levels) in <top (required)>'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/task.rb:236:in `call'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/task.rb:231:in `each'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/Users/michaeltaylor/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/task.rb:197:in `block in invoke_prerequisites'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/task.rb:195:in `each'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/task.rb:195:in `invoke_prerequisites'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/task.rb:174:in `block in invoke_with_call_chain'
/Users/michaeltaylor/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/application.rb:106:in `each'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/application.rb:106:in `block in top_level'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/application.rb:78:in `block in run'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/bin/rake:23:in `load'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/bin/rake:23:in `<main>'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `eval'
/Users/michaeltaylor/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:setup => db:seed
Doesn't look like a Postgres issue. Judging by the stack trace, apparently you need to start your ElasticSearch server.
I just reinstalled my Ubuntu, so I installed Ribu and Rails. All was going pretty well, but when I tried to make a model (database table) a couple errors showed up.
Here's the error without trace:
cdr#ubuntu:~/pro$ rake db:migrate
== CreateMonsters: migrating =================================================
-- create_table(:monsters)
rake aborted!
An error has occurred, this and all later migrations canceled:
undefined method `straing' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x000000023cae90>
/home/cdr/pro/db/migrate/20121201195505_create_monsters.rb:4:in `block in change'
/home/cdr/pro/db/migrate/20121201195505_create_monsters.rb:3:in `change'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
This is with trace:
cdr#ubuntu:~/pro$ 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
== CreateMonsters: migrating =================================================
-- create_table(:monsters)
rake aborted!
An error has occurred, this and all later migrations canceled:
undefined method `straing' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x00000003f4c3d0>
/home/cdr/pro/db/migrate/20121201195505_create_monsters.rb:4:in `block in change'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/schema_statements.rb:160:in `create_table'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.9/lib/active_record/migration.rb:466:in `block in method_missing'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.9/lib/active_record/migration.rb:438:in `block in say_with_time'
/usr/lib/ruby/1.9.1/benchmark.rb:280:in `measure'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.9/lib/active_record/migration.rb:438:in `say_with_time'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.9/lib/active_record/migration.rb:458:in `method_missing'
/home/cdr/pro/db/migrate/20121201195505_create_monsters.rb:3:in `change'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.9/lib/active_record/migration.rb:407:in `block (2 levels) in migrate'
/usr/lib/ruby/1.9.1/benchmark.rb:280:in `measure'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.9/lib/active_record/migration.rb:407:in `block in migrate'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:129:in `with_connection'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.9/lib/active_record/migration.rb:389:in `migrate'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.9/lib/active_record/migration.rb:528:in `migrate'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.9/lib/active_record/migration.rb:720:in `block (2 levels) in migrate'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.9/lib/active_record/migration.rb:775:in `call'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.9/lib/active_record/migration.rb:775:in `block in ddl_transaction'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.9/lib/active_record/transactions.rb:208:in `transaction'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.9/lib/active_record/migration.rb:775:in `ddl_transaction'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.9/lib/active_record/migration.rb:719:in `block in migrate'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.9/lib/active_record/migration.rb:700:in `each'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.9/lib/active_record/migration.rb:700:in `migrate'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.9/lib/active_record/migration.rb:570:in `up'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.9/lib/active_record/migration.rb:551:in `migrate'
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.2.9/lib/active_record/railties/databases.rake:179:in `block (2 levels) in <top (required)>'
/usr/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:227:in `call'
/usr/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:227:in `block in execute'
/usr/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:222:in `each'
/usr/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:222:in `execute'
/usr/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
/usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/usr/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:159:in `invoke_with_call_chain'
/usr/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/task.rb:152:in `invoke'
/usr/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:141:in `invoke_task'
/usr/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:99:in `block (2 levels) in top_level'
/usr/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:99:in `each'
/usr/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:99:in `block in top_level'
/usr/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:108:in `run_with_threads'
/usr/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:93:in `top_level'
/usr/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:71:in `block in run'
/usr/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:158:in `standard_exception_handling'
/usr/lib/ruby/gems/1.9.1/gems/rake-10.0.2/lib/rake/application.rb:68:in `run'
/usr/lib/ruby/gems/1.9.1/gems/rake-10.0.2/bin/rake:37:in `<top (required)>'
/usr/bin/rake:23:in `load'
/usr/bin/rake:23:in `<main>'
Tasks: TOP => db:migrate
This is the migration:
class CreateMonsters < ActiveRecord::Migration
def change
create_table :monsters do |t|
t.straing :name
t.text :description
t.timestamps
end
end
end
t.straing? should that be t.string
the error you posted (snippet below)
An error has occurred, this and all later migrations canceled:
undefined method `straing'
is pointing you in the direction of what's wrong
I'm new to Rails, and am following the getting started guide on their website.
I'm getting an error when I run $ rake db:migrate in section: http://guides.rubyonrails.org/getting_started.html#generating-a-model
It worked for the first time in section: http://guides.rubyonrails.org/getting_started.html#running-a-migration
So I don't know what is wrong.
When I run $ rake db:migrate
== CreateComments: migrating =================================================
-- create_table(:comments)
rake aborted!
An error has occurred, this and all later migrations canceled:
private method `test' called for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x007f83a27503c8>
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
So I followed the instructions to run it with the --trace argument; I was wondering if anyone has a clue what it means, and what the issue is?
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:migrate
== CreateComments: migrating =================================================
-- create_table(:comments)
rake aborted!
An error has occurred, this and all later migrations canceled:
private method `test' called for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x007f8bacbba730>
/Users/parnmatt/Sites/test-rails/blog/db/migrate/20120627130542_create_comments.rb:5:in `block in change'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/schema_statements.rb:160:in `create_table'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:466:in `block in method_missing'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:438:in `block in say_with_time'
/Users/parnmatt/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/benchmark.rb:280:in `measure'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:438:in `say_with_time'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:458:in `method_missing'
/Users/parnmatt/Sites/test-rails/blog/db/migrate/20120627130542_create_comments.rb:3:in `change'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:407:in `block (2 levels) in migrate'
/Users/parnmatt/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/benchmark.rb:280:in `measure'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:407:in `block in migrate'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:123:in `with_connection'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:389:in `migrate'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:528:in `migrate'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:720:in `block (2 levels) in migrate'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:775:in `call'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:775:in `block in ddl_transaction'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/transactions.rb:208:in `transaction'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:775:in `ddl_transaction'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:719:in `block in migrate'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:700:in `each'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:700:in `migrate'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:570:in `up'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/migration.rb:551:in `migrate'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.6/lib/active_record/railties/databases.rake:153:in `block (2 levels) in <top (required)>'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/parnmatt/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/bin/rake:19:in `load'
/Users/parnmatt/.rvm/gems/ruby-1.9.3-p0/bin/rake:19:in `<main>'
Tasks: TOP => db:migrate
This is the migration code generated:
class CreateComments < ActiveRecord::Migration
def change
create_table :comments do |t|
t.string :commenter
t.test :body
t.references :post
t.timestamps
end
add_index :comments, :post_id
end
end
Looks like when you ran the generator you said 'test' instead of 'text' for body.
Should have been: $ rails generate model Comment commenter:string body:text post:references
Rake doesn't know what type t.test is...it would have been t.text
I have a trivial Rails migration that is failing when I run rake db:migrate. This is in a development environment using SQLite3. This is the migration:
class RemoveMobileUserIdFromDevices < ActiveRecord::Migration
def up
remove_column :devices, :mobile_user_id
end
def down
add_column :devices, :mobile_user_id, :integer
end
end
I am experiencing the following error when running rake db:migrate:
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:migrate
== RemoveMobileUserIdFromDevices: migrating ==================================
-- remove_column(:devices, :mobile_user_id)
rake aborted!
An error has occurred, this and all later migrations canceled:
incompatible character encodings: ASCII-8BIT and UTF-8
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/connection_adapters/sqlite_adapter.rb:516:in `*'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/connection_adapters/sqlite_adapter.rb:516:in `block in copy_table_contents'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/result.rb:20:in `block in each'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/result.rb:20:in `each'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/result.rb:20:in `each'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/connection_adapters/sqlite_adapter.rb:514:in `copy_table_contents'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/connection_adapters/sqlite_adapter.rb:478:in `copy_table'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/connection_adapters/sqlite_adapter.rb:455:in `move_table'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/connection_adapters/sqlite_adapter.rb:448:in `block in alter_table'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/connection_adapters/sqlite_adapter.rb:447:in `alter_table'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/connection_adapters/sqlite_adapter.rb:387:in `block in remove_column'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/connection_adapters/sqlite_adapter.rb:386:in `each'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/connection_adapters/sqlite_adapter.rb:386:in `remove_column'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/migration.rb:447:in `block in method_missing'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/migration.rb:422:in `block in say_with_time'
/Users/username/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/benchmark.rb:280:in `measure'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/migration.rb:422:in `say_with_time'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/migration.rb:442:in `method_missing'
/Users/username/[removed]/[removed]/db/migrate/20120127204256_remove_mobile_user_id_from_devices.rb:3:in `up'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/migration.rb:394:in `block (2 levels) in migrate'
/Users/username/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/benchmark.rb:280:in `measure'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/migration.rb:394:in `block in migrate'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:185:in `with_connection'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/migration.rb:375:in `migrate'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/migration.rb:507:in `migrate'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/migration.rb:687:in `block (2 levels) in migrate'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/migration.rb:742:in `call'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/migration.rb:742:in `block in ddl_transaction'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/transactions.rb:208:in `transaction'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/migration.rb:742:in `ddl_transaction'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/migration.rb:686:in `block in migrate'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/migration.rb:671:in `each'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/migration.rb:671:in `migrate'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/migration.rb:549:in `up'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/migration.rb:530:in `migrate'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.1.3/lib/active_record/railties/databases.rake:161:in `block (2 levels) in <top (required)>'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/username/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/username/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/username/.rvm/gems/ruby-1.9.3-p0/bin/rake:19:in `load'
/Users/username/.rvm/gems/ruby-1.9.3-p0/bin/rake:19:in `<main>'
Tasks: TOP => db:migrate
I'm not sure what the issue could be, as I have previous migrations with similar commands that have executed without issue. So far, I have tried typing the migration file by hand in TextMate (under the presumption that the actual file may have had a bad character encoding). I have also deleted the migration and recreated it via rails g migration RemoveMobileUserIdFromDevices mobile_user_id:integer but have seen no change.