I have migration 20150930051523_create_objects.rb:
class CreateObjects < ActiveRecord::Migration
def change
create_table :objects do |t|
t.text :name
t.timestamps null: false
end
Object.create :name => "A"
Object.create :name => "B"
Object.create :name => "C"
end
end
$ rake:db migrate --trace cause output:
** Invoke db:migrate (first_time)
** Invoke db:environment (first_time)
** Execute db:environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
== 20150930051523 CreateObjects: migrating ====================================
-- create_table(:objects)
-> 0.0010s
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
uninitialized constant CreateObjects::Object/db/migrate/20150930051523_create_objects.rb:8:in `change'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:605:in `exec_migration'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:589:in `block (2 levels) in migrate'
/usr/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:588:in `block in migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:587:in `migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:765:in `migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:995:in `block in execute_migration_in_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:1041:in `block in ddl_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/transactions.rb:220:in `transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:1041:in `ddl_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:994:in `execute_migration_in_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:956:in `block in migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:952:in `each'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:952:in `migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:820:in `up'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:798:in `migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/railties/databases.rake:44:in `block (2 levels) in '
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/var/lib/gems/2.1.0/gems/rake-10.4.2/bin/rake:33:in `'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `'
NameError: uninitialized constant CreateObjects::Object/db/migrate/20150930051523_create_barbers.rb:8:in `change'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:605:in `exec_migration'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:589:in `block (2 levels) in migrate'
/usr/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:588:in `block in migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:587:in `migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:765:in `migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:995:in `block in execute_migration_in_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:1041:in `block in ddl_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/transactions.rb:220:in `transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:1041:in `ddl_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:994:in `execute_migration_in_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:956:in `block in migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:952:in `each'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:952:in `migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:820:in `up'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/migration.rb:798:in `migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.4/lib/active_record/railties/databases.rake:44:in `block (2 levels) in '
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/var/lib/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/var/lib/gems/2.1.0/gems/rake-10.4.2/bin/rake:33:in `'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `'
Tasks: TOP => db:migrate
Error emerging at Object.create... stage, what is wrong?
Update: In a comment it was pointed out that the actual code was not containing "Object", this answer is thus based on the wrong example.
Object is a bad name to use for an (unscoped) Model class, as it is already defined by Ruby.
The Object you are calling create on is probably not the Object class you defined in your model sources.
I assume you run rails. Remove the Object.create lines from your migration. Run it, it should work fine. Then, call rails console, where you end up in a live session. Here you can play around with your code, e.g. call Object.create, Object.where{id: 1} etc. I assume that you will get the same errors.
So, as a solution, rename your Object into something else, like Class and look if it works.
Okay, that was a joke, of course Class is also a really bad name for a model class :) . Try to find something more meaningful.
The problem was solved by set up pg gem, which pull bundle of another gems and packs (particularly postgresql-server-dev-all). After installing it, the command rake db:migrate works fine and completely.
Related
I am using delayed jobs and I think I have a problem with serialization. We are using ruby 2.2.2.
In my model I have a callback that fires on save and creates a delayed job for my model. like this:
after_create :update_queue
def update_queue
self.class.delay(run_at: 1.minutes.from_now, delayed_reference_id: self.id, delayed_reference_type: "Payment", queue: "qbo_payments").delayed_task(self.id)
end
def self.delayed_task
# Do some stuff
end
However I am getting the error:
undefined method `delayed_task' for #<Class:0x0000000f93f9b8>
~/shared/bundle/ruby/2.2.0/gems/activerecord-4.2.0/lib/active_record/dynamic_matchers.rb:26:in `method_missing'
~/shared/bundle/ruby/2.2.0/gems/attr_encrypted-3.0.3/lib/attr_encrypted.rb:295:in `method_missing'
~/shared/bundle/ruby/2.2.0/gems/attr_encrypted-3.0.3/lib/attr_encrypted/adapters/active_record.rb:129:in `method_missing_with_attr_encrypted'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/performable_method.rb:26:in `perform'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/backend/base.rb:84:in `block in invoke_job'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:61:in `call'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:61:in `block in initialize'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:66:in `call'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:66:in `execute'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:40:in `run_callbacks'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/backend/base.rb:81:in `invoke_job'
~/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.16.0.318/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb:127:in `block in invoke_job'
~/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.16.0.318/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:363:in `perform_action_with_newrelic_trace'
~/shared/bundle/ruby/2.2.0/gems/newrelic_rpm-3.16.0.318/lib/new_relic/agent/instrumentation/delayed_job_instrumentation.rb:126:in `invoke_job'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/worker.rb:230:in `block (2 levels) in run'
/usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/timeout.rb:89:in `block in timeout'
/usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/timeout.rb:99:in `call'
/usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/timeout.rb:99:in `timeout'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/worker.rb:230:in `block in run'
/usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/benchmark.rb:303:in `realtime'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/worker.rb:229:in `run'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/worker.rb:306:in `block in reserve_and_run_one_job'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:61:in `call'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:61:in `block in initialize'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:66:in `call'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:66:in `execute'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:40:in `run_callbacks'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/worker.rb:306:in `reserve_and_run_one_job'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/worker.rb:213:in `block in work_off'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/worker.rb:212:in `times'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/worker.rb:212:in `work_off'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/worker.rb:175:in `block (4 levels) in start'
/usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/benchmark.rb:303:in `realtime'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/worker.rb:174:in `block (3 levels) in start'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:61:in `call'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:61:in `block in initialize'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:66:in `call'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:66:in `execute'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:40:in `run_callbacks'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/worker.rb:173:in `block (2 levels) in start'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/worker.rb:172:in `loop'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/worker.rb:172:in `block in start'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/plugins/clear_locks.rb:7:in `call'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/plugins/clear_locks.rb:7:in `block (2 levels) in <class:ClearLocks>'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:79:in `call'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:79:in `block (2 levels) in add'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:61:in `call'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:61:in `block in initialize'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:79:in `call'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:79:in `block in add'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:66:in `call'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:66:in `execute'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/lifecycle.rb:40:in `run_callbacks'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/worker.rb:171:in `start'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/command.rb:132:in `run'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/command.rb:120:in `block in run_process'
~/shared/bundle/ruby/2.2.0/gems/daemons-1.2.3/lib/daemons/application.rb:265:in `call'
~/shared/bundle/ruby/2.2.0/gems/daemons-1.2.3/lib/daemons/application.rb:265:in `block in start_proc'
~/shared/bundle/ruby/2.2.0/gems/daemons-1.2.3/lib/daemons/daemonize.rb:84:in `call'
~/shared/bundle/ruby/2.2.0/gems/daemons-1.2.3/lib/daemons/daemonize.rb:84:in `call_as_daemon'
~/shared/bundle/ruby/2.2.0/gems/daemons-1.2.3/lib/daemons/application.rb:269:in `start_proc'
~/shared/bundle/ruby/2.2.0/gems/daemons-1.2.3/lib/daemons/application.rb:295:in `start'
~/shared/bundle/ruby/2.2.0/gems/daemons-1.2.3/lib/daemons/controller.rb:69:in `run'
~/shared/bundle/ruby/2.2.0/gems/daemons-1.2.3/lib/daemons.rb:193:in `block in run_proc'
~/shared/bundle/ruby/2.2.0/gems/daemons-1.2.3/lib/daemons/cmdline.rb:88:in `call'
~/shared/bundle/ruby/2.2.0/gems/daemons-1.2.3/lib/daemons/cmdline.rb:88:in `catch_exceptions'
~/shared/bundle/ruby/2.2.0/gems/daemons-1.2.3/lib/daemons.rb:192:in `run_proc'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/command.rb:118:in `run_process'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/command.rb:99:in `block in daemonize'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/command.rb:97:in `times'
~/shared/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/command.rb:97:in `daemonize'
script/delayed_job:5:in `<main>'"
What I have tried
After a bit of google research I found 2 fixes. The first and more widely accepted fix is to add:
require 'yaml'
YAML::ENGINE.yamler = 'syck'
#https://github.com/collectiveidea/delayed_job/issues/199
However, syck is no longer supported for ruby 2.2.2
The second solution, which only seemed to exacerbate the problem, was to add "bundle exec" to my delayed_job startup script like this:
run "cd #{current_path}; bundle exec script/delayed_job start #{rails_env}"
This will work !
after_create :update_queue
def update_queue
self.delay(run_at: 1.minutes.from_now, delayed_reference_id: self.id, delayed_reference_type: "Payment", queue: "qbo_payments").delayed_task()
end
def delayed_task
self.class.delayed_task(self.id)
end
def self.delayed_task
# Do some stuff
end
I recently tried to updated my Rails app from Rails 3.2 to Rails 4.2. Before the upgrade all my test suite runs perfectly, but after the update I'm getting something strange. every time i tried to run a test the same error happens
rake db:fixtures:load --trace
** Invoke db:fixtures:load (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:fixtures:load
rake aborted!
NameError: uninitialized constant ActiveRecord::FixtureSet::RenderContext::MassiveMessage
(erb):11:in `get_binding'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/erb.rb:863:in `eval'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/erb.rb:863:in `result'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixture_set/file.rb:42:in `render'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixture_set/file.rb:33:in `rows'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixture_set/file.rb:24:in `each'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:758:in `block (2 levels) in read_fixture_files'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixture_set/file.rb:15:in `open'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:757:in `block in read_fixture_files'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:756:in `each'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:756:in `each_with_object'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:756:in `read_fixture_files'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:592:in `initialize'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:514:in `new'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:514:in `block (2 levels) in create_fixtures'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:511:in `map'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:511:in `block in create_fixtures'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:282:in `disable_referential_integrity'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:508:in `create_fixtures'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/railties/databases.rake:203:in `block (3 levels) in '
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:240:in `call'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:240:in `block in execute'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:235:in `each'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:235:in `execute'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:172:in `invoke_with_call_chain'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:165:in `invoke'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:150:in `invoke_task'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `block (2 levels) in top_level'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `each'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `block in top_level'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:115:in `run_with_threads'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:100:in `top_level'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:78:in `block in run'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling'
/home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:75:in `run'
/home/alexander/.rvm/rubies/ruby-2.2.0/bin/rake:33:in `'
Can anyone help me with this?
After deleting that Fixtures i get another error see
rake aborted!
TypeError: no implicit conversion of Fixnum into String
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:636:in `gsub'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:636:in `block (2 levels) in table_rows'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:635:in `each'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:635:in `block in table_rows'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:623:in `each'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:623:in `map'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:623:in `table_rows'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:526:in `block (3 levels) in create_fixtures'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:524:in `each'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:524:in `block (2 levels) in create_fixtures'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:523:in `block in create_fixtures'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:282:in `disable_referential_integrity'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:508:in `create_fixtures'
/home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/railties/databases.rake:203:in `block (3 levels) in '
Tasks: TOP => db:fixtures:load
(See full trace by running task with --trace)
:(
I did a progressive updatefrom rails 3.2 to 4.02, then from 4.02 to 4.1, all worked smoothly, then at rails 4.2 i got the same error
i posted the issue at github in rails repositories and they answer me that it's a bug and will be released at version 4.2.1
for the moment you can correct this doing this.
row[key] = value.gsub("$LABEL", label.to_s) if value.is_a?(String)
at line 636 of the file fixture.rb from activerecord library
I am a new user on RoR. I would really appreciate it if you can give me some guidance here. Below is the issue that I have encountered. Thank you in advance!
I am trying to do the following command
C:\Users\01TAN\rails_projects\demo_app>bundle exec rake db:migrate
However, I received the following error
rake aborted!
An error has occurred, this and all later migrations canceled:
undefined method `vantan08' for #<ActiveRecord::ConnectionAdapters::TableDefinit
ion:0x217c128>
I used the trace command and below is the report:
C:\Users\01TAN\rails_projects\demo_app>rake db:migrate --trace
** 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
== CreateUsers: migrating ====================================================
-- create_table(:users)
rake aborted!
An error has occurred, this and all later migrations canceled:
undefined method `vantan08' for #<ActiveRecord::ConnectionAdapters::TableDefinit
ion:0x2378430>
C:/Users/01TAN/rails_projects/demo_app/db/migrate/20120325153442_create_users.rb
:4:in `block in change'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti
ve_record/connection_adapters/abstract/schema_statements.rb:160:in `create_table
'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti
ve_record/migration.rb:450:in `block in method_missing'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti
ve_record/migration.rb:424:in `block in say_with_time'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/benchmark.rb:280:in `measure'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti
ve_record/migration.rb:424:in `say_with_time'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti
ve_record/migration.rb:444:in `method_missing'
C:/Users/01TAN/rails_projects/demo_app/db/migrate/20120325153442_create_users.rb
:3:in `change'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti
ve_record/migration.rb:393:in `block (2 levels) in migrate'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/benchmark.rb:280:in `measure'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti
ve_record/migration.rb:393:in `block in migrate'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti
ve_record/connection_adapters/abstract/connection_pool.rb:118:in `with_connectio
n'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti
ve_record/migration.rb:377:in `migrate'
C:in `migrate'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti
ve_record/migration.rb:704:in `block (2 levels) in migrate'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti
ve_record/migration.rb:759:in `call'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti
ve_record/migration.rb:759:in `block in ddl_transaction'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti
ve_record/connection_adapters/abstract/database_statements.rb:190:in `transactio
n'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti
ve_record/transactions.rb:208:in `transaction'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti
ve_record/migration.rb:759:in `ddl_transaction'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti
ve_record/migration.rb:703:in `block in migrate'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti
ve_record/migration.rb:684:in `each'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti
ve_record/migration.rb:684:in `migrate'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti
ve_record/migration.rb:554:in `up'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti
ve_record/migration.rb:535:in `migrate'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti
ve_record/railties/databases.rake:153:in `block (2 levels) in <top (required)>'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.
rb:205:in `call'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.
rb:205:in `block in execute'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.
rb:200:in `each'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.
rb:200:in `execute'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.
rb:158:in `block in invoke_with_call_chain'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.
rb:151:in `invoke_with_call_chain'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.
rb:144:in `invoke'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:116:in `invoke_task'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:94:in `block (2 levels) in top_level'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:94:in `each'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:94:in `block in top_level'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:133:in `standard_exception_handling'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:88:in `top_level'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:66:in `block in run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:133:in `standard_exception_handling'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli
cation.rb:63:in `run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in
`<top (required)>'
C:/RailsInstaller/Ruby1.9.3/bin/rake:19:in `load'
C:/RailsInstaller/Ruby1.9.3/bin/rake:19:in `<main>'
Tasks: TOP => db:migrate
My guess is that the migration you were writing mixed up the name of a column with the type of a column. Migrations should look something like this in Rails 3.2.1:
class CreatePeople < ActiveRecord::Migration
def change
create_table :people do |t|
t.string :name
t.string :email
t.timestamps
end
end
end
I have changed my paperclip styles and want to refresh them on heroku. I do as
heroku run rake --trace paperclip:refresh CLASS=VenueImage
and get the error
** Invoke paperclip:refresh (first_time)
** Invoke paperclip:refresh:metadata (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute paperclip:refresh:metadata
rake aborted!
uninitialized constant VenueImage
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/ext/module.rb:36:in `const_missing'
/app/vendor/bundle/ruby/1.9.1/gems/paperclip-2.7.0/lib/paperclip.rb:179:in `block in class_for'
/app/vendor/bundle/ruby/1.9.1/gems/paperclip-2.7.0/lib/paperclip.rb:178:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/paperclip-2.7.0/lib/paperclip.rb:178:in `inject'
/app/vendor/bundle/ruby/1.9.1/gems/paperclip-2.7.0/lib/paperclip.rb:178:in `class_for'
/app/vendor/bundle/ruby/1.9.1/gems/paperclip-2.7.0/lib/tasks/paperclip.rake:10:in `obtain_attachments'
/app/vendor/bundle/ruby/1.9.1/gems/paperclip-2.7.0/lib/tasks/paperclip.rake:45:in `block (3 levels) in <top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/app/vendor/bundle/ruby/1.9.1/bin/rake:19:in `load'
/app/vendor/bundle/ruby/1.9.1/bin/rake:19:in `<main>'
Tasks: TOP => paperclip:refresh => paperclip:refresh:metadata
Now given that class VenueImage definitely exists.
heroku run console
Loading production environment (Rails 3.2.2)
irb(main):001:0> VenueImage
=> VenueImage(id: integer, venue_id: integer, image_file_name: string,
image_content_type: string, image_file_size: integer,
image_updated_at: datetime, created_at: datetime, updated_at: datetime)
What could be going on here?
I am trying to precompile assets (rake assets:precompile or bundle exec rake assets:precompile), but I always get the error
/Users/adam/.rvm/rubies/ruby-1.9.2-p290/bin/ruby /Users/adam/.rvm/gems/ruby-1.9.2-p290/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
Access denied for user 'root'#'localhost' (using password: YES)
Tasks: TOP => environment
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/Users/adam/.rvm/rubies/ruby-1.9.2-p290/b...]
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
Has anybody an idea what could be wrong?
EDIT trace output
rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/Users/adam/.rvm/rubies/ruby-1.9.2-p290/bin/ruby /Users/adam/.rvm/gems/ruby-1.9.2-p290/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
rake aborted!
Access denied for user 'root'#'localhost' (using password: YES)
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `connect'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `initialize'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:277:in `new_connection'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:287:in `checkout_new_connection'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:235:in `block (2 levels) in checkout'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:230:in `loop'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:230:in `block in checkout'
/Users/adam/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:229:in `checkout'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:95:in `connection'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `retrieve_connection'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:168:in `retrieve_connection'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:142:in `connection'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/model_schema.rb:308:in `clear_cache!'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.1/lib/active_record/railtie.rb:91:in `block (2 levels) in <class:Railtie>'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:418:in `_run__1002303312927586119__prepare__1187908839264703097__callbacks'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:405:in `__run_callback'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.1/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.1/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `instance_exec'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `run'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `each'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `run_initializers'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/application.rb:136:in `initialize!'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/adam/rubydev/aivloo/config/environment.rb:5:in `<top (required)>'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `block in require'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/application.rb:103:in `require_environment!'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/application.rb:292:in `block (2 levels) in initialize_tasks'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/adam/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.1/lib/sprockets/assets.rake:89:in `block (2 levels) in <top (required)>'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/adam/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
/Users/adam/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.1/lib/sprockets/assets.rake:56:in `block (3 levels) in <top (required)>'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/adam/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `<main>'
Tasks: TOP => environment
rake aborted!
Command failed with status (1): [/Users/adam/.rvm/rubies/ruby-1.9.2-p290/b...]
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `call'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `sh'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `sh'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/file_utils.rb:80:in `ruby'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `ruby'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.1/lib/sprockets/assets.rake:9:in `ruby_rake_task'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.1/lib/sprockets/assets.rake:17:in `invoke_or_reboot_rake_task'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.2.1/lib/sprockets/assets.rake:25:in `block (2 levels) in <top (required)>'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/adam/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
/Users/adam/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `<main>'
Tasks: TOP => assets:precompile
Not your issue, but if a Google search brings someone else here (as it did me) make sure you're specifying what RAILS_ENV you're in:
rake assets:precompile RAILS_ENV=development
I was running a precompile test in development and kept getting this error until I remembered to put the environment.
You've got a wrong password/username combination for your MySQL database. There are some gems that "need" database access for asset precompilation, to turn this off, check this question for Devise.