Rails Executing migration ArgumentError - ruby-on-rails

I'm having a strange problem executing rake db:migrate
== 20141127213559 CreateMovies: migrating =====================================
-- create_table(:movies)
-> 0.0033s
== 20141127213559 CreateMovies: migrated (0.0034s) ============================
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
wrong number of arguments (1 for 0)
ArgumentError: wrong number of arguments (1 for 0)
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
What I did was:
rails generate model Movie
And then edit the migration CreateMovies
class CreateMovies < ActiveRecord::Migration
def up
#drop_table :movies
create_table :movies do |t|
t.string :title
t.string :rating
t.text :description
t.datetime :release_date
# Add fields that let Rails automatically keep track
# of when movies are added or modified:
t.timestamps
end
end
def down
drop_table :movies
end
end
This is the output of executing the command with --trace
[fran#arch rottenpotatoes]$ 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
== 20141127213559 CreateMovies: migrating =====================================
-- create_table(:movies)
-> 0.0039s
== 20141127213559 CreateMovies: migrated (0.0041s) ============================
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
wrong number of arguments (1 for 0)/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract_adapter.rb:271:in `initialize'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract_adapter.rb:271:in `new'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract_adapter.rb:271:in `substitute_at'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/relation.rb:97:in `block in substitute_values'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/relation.rb:96:in `each'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/relation.rb:96:in `each_with_index'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/relation.rb:96:in `substitute_values'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/relation.rb:56:in `insert'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/persistence.rb:521:in `_create_record'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/counter_cache.rb:139:in `_create_record'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/attribute_methods/dirty.rb:122:in `_create_record'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/callbacks.rb:306:in `block in _create_record'
/usr/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:88:in `call'
/usr/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:88:in `_run_callbacks'
/usr/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:734:in `_run_create_callbacks'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/callbacks.rb:306:in `_create_record'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/timestamp.rb:57:in `_create_record'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/persistence.rb:501:in `create_or_update'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/callbacks.rb:302:in `block in create_or_update'
/usr/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:88:in `call'
/usr/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:88:in `_run_callbacks'
/usr/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:734:in `_run_save_callbacks'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/callbacks.rb:302:in `create_or_update'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/persistence.rb:142:in `save!'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/validations.rb:42:in `save!'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:289:in `block in save!'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:345:in `block in with_transaction_returning_status'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:218:in `transaction'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:342:in `with_transaction_returning_status'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:289:in `save!'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/persistence.rb:51:in `create!'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:1015:in `record_version_state_after_migrating'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:985:in `block in execute_migration_in_transaction'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:1030:in `block in ddl_transaction'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:218:in `transaction'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:1030:in `ddl_transaction'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:983:in `execute_migration_in_transaction'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:945:in `block in migrate'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:941:in `each'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:941:in `migrate'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:813:in `up'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:791:in `migrate'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/task.rb:240:in `call'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/task.rb:240:in `block in execute'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/task.rb:235:in `each'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/task.rb:235:in `execute'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/task.rb:165:in `invoke'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/application.rb:156:in `invoke_task'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/application.rb:112:in `block (2 levels) in top_level'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/application.rb:112:in `each'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/application.rb:112:in `block in top_level'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/application.rb:121:in `run_with_threads'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/application.rb:106:in `top_level'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/application.rb:84:in `block in run'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/application.rb:182:in `standard_exception_handling'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/application.rb:79:in `run'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/bin/rake:33:in `<top (required)>'
/home/fran/.gem/ruby/2.1.0/bin/rake:23:in `load'
/home/fran/.gem/ruby/2.1.0/bin/rake:23:in `<main>'
ArgumentError: wrong number of arguments (1 for 0)
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract_adapter.rb:271:in `initialize'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract_adapter.rb:271:in `new'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract_adapter.rb:271:in `substitute_at'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/relation.rb:97:in `block in substitute_values'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/relation.rb:96:in `each'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/relation.rb:96:in `each_with_index'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/relation.rb:96:in `substitute_values'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/relation.rb:56:in `insert'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/persistence.rb:521:in `_create_record'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/counter_cache.rb:139:in `_create_record'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/attribute_methods/dirty.rb:122:in `_create_record'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/callbacks.rb:306:in `block in _create_record'
/usr/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:88:in `call'
/usr/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:88:in `_run_callbacks'
/usr/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:734:in `_run_create_callbacks'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/callbacks.rb:306:in `_create_record'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/timestamp.rb:57:in `_create_record'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/persistence.rb:501:in `create_or_update'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/callbacks.rb:302:in `block in create_or_update'
/usr/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:88:in `call'
/usr/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:88:in `_run_callbacks'
/usr/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:734:in `_run_save_callbacks'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/callbacks.rb:302:in `create_or_update'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/persistence.rb:142:in `save!'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/validations.rb:42:in `save!'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:289:in `block in save!'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:345:in `block in with_transaction_returning_status'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:218:in `transaction'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:342:in `with_transaction_returning_status'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:289:in `save!'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/persistence.rb:51:in `create!'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:1015:in `record_version_state_after_migrating'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:985:in `block in execute_migration_in_transaction'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:1030:in `block in ddl_transaction'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:218:in `transaction'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:1030:in `ddl_transaction'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:983:in `execute_migration_in_transaction'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:945:in `block in migrate'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:941:in `each'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:941:in `migrate'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:813:in `up'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:791:in `migrate'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/usr/lib/ruby/gems/2.1.0/gems/activerecord-4.2.0.beta4/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/task.rb:240:in `call'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/task.rb:240:in `block in execute'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/task.rb:235:in `each'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/task.rb:235:in `execute'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/task.rb:165:in `invoke'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/application.rb:156:in `invoke_task'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/application.rb:112:in `block (2 levels) in top_level'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/application.rb:112:in `each'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/application.rb:112:in `block in top_level'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/application.rb:121:in `run_with_threads'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/application.rb:106:in `top_level'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/application.rb:84:in `block in run'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/application.rb:182:in `standard_exception_handling'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/lib/rake/application.rb:79:in `run'
/usr/lib/ruby/gems/2.1.0/gems/rake-10.4.0/bin/rake:33:in `<top (required)>'
/home/fran/.gem/ruby/2.1.0/bin/rake:23:in `load'
/home/fran/.gem/ruby/2.1.0/bin/rake:23:in `<main>'
Tasks: TOP => db:migrate
Any help would be really appreciated. Thanks.

If you are using Rails 4.2.0.beta4, ActiveRecord will require arel gem. Add the following to your gem file
gem 'arel', '6.0.0.beta2'
and run
bundle install
You may get below error message
You have requested:arel = 6.0.0.beta2
The bundle currently has arel locked at 6.0.0.
Try running `bundle update arel`
then
bundle update arel
Now you should able to run migration.
Here you may find similar and explanatory answer: Can't migrate database after scaffold. Section 2.2 Ruby on Rails Tutorial Michael Hartl

Maybe you should execute this after create movies table:
generate migration AddFieldsToMovies newfield:type
This generates the correct migration, see this:
http://edgeguides.rubyonrails.org/active_record_migrations.html#changing-tables

Related

NoMethodError: undefined method `value_for_database' for #<Array> (Rails 5)

I've got a (brand new) Rails 5 project that's throwing errors when I try to run migrations.
(I'm running Ruby 2.2.4 on a Raspberry Pi using PostgreSQL 9.4, but the same error message popped up when I first tried running the migration with SQLite.)
So far, the only migration I've got is pretty basic:
class CreateAuthors < ActiveRecord::Migration[5.0]
def change
create_table :authors do |t|
t.string :username
t.timestamps
end
end
end
This results in the following output when I run rake db:migrate.
pi#raspberrypi:~/projects/gnn $ rake db:migrate
== 20160915091621 CreateAuthors: migrating ====================================
-- create_table(:authors, {})
-> 0.0283s
== 20160915091621 CreateAuthors: migrated (0.0287s) ===========================
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
undefined method `value_for_database' for #<Array:0x2a10470>
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:597:in `block in exec_no_cache'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:597:in `each'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:597:in `map'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:597:in `exec_no_cache'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:587:in `execute_and_clear'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:103:in `exec_query'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:135:in `exec_insert'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:124:in `insert'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/query_cache.rb:14:in `insert'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/relation.rb:65:in `insert'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/persistence.rb:554:in `_create_record'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/counter_cache.rb:128:in `_create_record'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/locking/optimistic.rb:75:in `_create_record'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/attribute_methods/dirty.rb:123:in `_create_record'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/callbacks.rb:302:in `block in _create_record'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:97:in `__run_callbacks__'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:750:in `_run_create_callbacks'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/callbacks.rb:302:in `_create_record'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/timestamp.rb:68:in `_create_record'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/persistence.rb:534:in `create_or_update'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/callbacks.rb:298:in `block in create_or_update'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:97:in `__run_callbacks__'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:750:in `_run_save_callbacks'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/callbacks.rb:298:in `create_or_update'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/persistence.rb:152:in `save!'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/validations.rb:50:in `save!'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/attribute_methods/dirty.rb:30:in `save!'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:324:in `block in save!'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:395:in `block in with_transaction_returning_status'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:230:in `transaction'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:211:in `transaction'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:392:in `with_transaction_returning_status'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:324:in `save!'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/suppressor.rb:45:in `save!'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/persistence.rb:51:in `create!'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1247:in `record_version_state_after_migrating'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1212:in `block in execute_migration_in_transaction'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1279:in `block in ddl_transaction'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in `block in transaction'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/transaction.rb:189:in `within_new_transaction'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in `transaction'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:211:in `transaction'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1279:in `ddl_transaction'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1210:in `execute_migration_in_transaction'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1183:in `block in migrate_without_lock'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1182:in `each'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1182:in `migrate_without_lock'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1131:in `block in migrate'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1298:in `with_advisory_lock'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1131:in `migrate'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1005:in `up'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:983:in `migrate'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/tasks/database_tasks.rb:161:in `migrate'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/railties/databases.rake:58:in `block (2 levels) in <top (required)>'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
NoMethodError: undefined method `value_for_database' for #<Array:0x2a10470>
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:597:in `block in exec_no_cache'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:597:in `each'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:597:in `map'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:597:in `exec_no_cache'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:587:in `execute_and_clear'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:103:in `exec_query'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:135:in `exec_insert'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:124:in `insert'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/query_cache.rb:14:in `insert'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/relation.rb:65:in `insert'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/persistence.rb:554:in `_create_record'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/counter_cache.rb:128:in `_create_record'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/locking/optimistic.rb:75:in `_create_record'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/attribute_methods/dirty.rb:123:in `_create_record'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/callbacks.rb:302:in `block in _create_record'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:97:in `__run_callbacks__'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:750:in `_run_create_callbacks'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/callbacks.rb:302:in `_create_record'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/timestamp.rb:68:in `_create_record'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/persistence.rb:534:in `create_or_update'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/callbacks.rb:298:in `block in create_or_update'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:97:in `__run_callbacks__'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:750:in `_run_save_callbacks'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/callbacks.rb:298:in `create_or_update'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/persistence.rb:152:in `save!'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/validations.rb:50:in `save!'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/attribute_methods/dirty.rb:30:in `save!'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:324:in `block in save!'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:395:in `block in with_transaction_returning_status'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:230:in `transaction'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:211:in `transaction'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:392:in `with_transaction_returning_status'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:324:in `save!'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/suppressor.rb:45:in `save!'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/persistence.rb:51:in `create!'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1247:in `record_version_state_after_migrating'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1212:in `block in execute_migration_in_transaction'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1279:in `block in ddl_transaction'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in `block in transaction'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/transaction.rb:189:in `within_new_transaction'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in `transaction'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:211:in `transaction'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1279:in `ddl_transaction'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1210:in `execute_migration_in_transaction'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1183:in `block in migrate_without_lock'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1182:in `each'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1182:in `migrate_without_lock'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1131:in `block in migrate'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1298:in `with_advisory_lock'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1131:in `migrate'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1005:in `up'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:983:in `migrate'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/tasks/database_tasks.rb:161:in `migrate'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/activerecord-5.0.0.1/lib/active_record/railties/databases.rake:58:in `block (2 levels) in <top (required)>'
/home/pi/.rvm/gems/ruby-2.2.4#gnn/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
Edit: Maybe worth saying that rake db:create ran fine.
Here's my database.yml file as well, in case I've missed something there (I'm pretty green with PostgreSQL)
default: &default
adapter: postgresql
encoding: unicode
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
development:
<<: *default
database: gnn_dev
username: gnn
password: Lorem123
host: localhost
port: 5432
I have met the same issue in the middle of development. Have found the reason.
In my case I added a new gem 'imgurapi', that adds 'to_hash' to Array objects
class Array # :nodoc:
# Skipped code
def to_hash # :nodoc:
inject({}) { |hsh, (k,v)| hsh[k] = v ; hsh }
end unless method_defined?(:to_hash)
end
As result the calling the code exec_query(sql, name, binds) in gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:135:in 'exec_insert' converts binds variable from Array to Hash type by the reason, that's good described here https://makandracards.com/makandra/36013-heads-up-ruby-implicitly-converts-a-hash-to-keyword-arguments. As result we have the error, because this conversion is unexpected.
Solution
Find the gem that defines 'to_hash' method for Array and get rid of this definition. Good luck!
Remove [5.0] from the first line .
class CreateAuthors < ActiveRecord::Migration
def change
create_table :authors do |t|
t.string :username
t.timestamps
end
end
end
thanks
Remove [5.0] from the first line
Restart the Server and run rake db:migrate.
May be this will helps you.

How to make non-utf8 encoding works for ActiveRecord?

My model insertion is in Shift_jis (Japanese),
The file has #encoding: shift_jis at the begining, then I do,
User.create({ user_name: "管理者" })
The character is shift_jis encoded!
My database is oracle (using oracle_enhanced ruby gems), which is also shift_jis encoded.
My OS is Windows-10 English but with Japanese as primary language (but I think default encoding is unicode?).
However, during the insertion, there's an error of:
Encoding::UndefinedConversionError: U+7BA1 to WINDOWS-1252 in conversion from Shift_JIS to UTF-8 to WINDOWS-1252
So here's the question:
I can probably understand that ActiveRecord internally converts shift_jis to utf-8, but how to let it insert into database as shift_jis?
Why there is a conversion to WINDOWS-1252?
Is there a solution for that? I tried to use utf-8 encoding for ActiveRecord (database is shift_jis which is strictly not changable), and I added encoding: sjis in database.yml, however, ActiveRecord still insert the data ase utf-8 without conversion. So the database returns error (character too long, it's understandable that utf-8 has longer bytes than shift_jis encoding).
Frankly I don't understand why ActiveRecord started to embrace utf-8 but dropped all supports for non-utf8 encoding. Database charset migration is too sensible for managers and they can't afford any such changes but it's hell for programmers to upgrade from rails legacy (where everything works) to latest version of rails (where such simple thing breaks and solution is hard to find).
As requested (I just changed my encoding to utf-8, but error is same, there's just not shift-jis to utf-8 conversion, but still error for utf-8 to windows-1252):
Path information removed because of 300000 characters limitation.
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
rake aborted!
StandardError: An error has occurred, all later migrations canceled:
Encoding::UndefinedConversionError: U+7BA1 to WINDOWS-1252 in conversion from UTF-8 to WINDOWS-1252: INSERT INTO "USERS" ("ID", "LOGIN", "HASHED_PASSWORD", "SALT", "USER_NAME", "START_DATE", "END_DATE", "MAIL", "MAIL_NOTIFICATION", "CREATED_AT", "UPDATED_AT") VALUES (:a1, :a2, :a3, :a4, :a5, :a6, :a7, :a8, :a9, :a10, :a11)
/gems/2.2.0/gems/ruby-oci8-2.2.1-x86-mingw32/lib/oci8/bindtype.rb:121:in `encode'
/gems/2.2.0/gems/ruby-oci8-2.2.1-x86-mingw32/lib/oci8/bindtype.rb:121:in `create'
/gems/2.2.0/gems/ruby-oci8-2.2.1-x86-mingw32/lib/oci8/cursor.rb:504:in `make_bind_object'
/gems/2.2.0/gems/ruby-oci8-2.2.1-x86-mingw32/lib/oci8/cursor.rb:99:in `bind_param'
/gems/2.2.0/gems/activerecord-oracle_enhanced-adapter-1.6.7/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb:143:in `bind_param'
/gems/2.2.0/gems/activerecord-oracle_enhanced-adapter-1.6.7/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb:139:in `block (2 levels) in exec_insert'
/gems/2.2.0/gems/activerecord-oracle_enhanced-adapter-1.6.7/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb:132:in `each'
/gems/2.2.0/gems/activerecord-oracle_enhanced-adapter-1.6.7/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb:132:in `each_with_index'
/gems/2.2.0/gems/activerecord-oracle_enhanced-adapter-1.6.7/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb:132:in `block in exec_insert'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log'
/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `log'
/gems/2.2.0/gems/activerecord-oracle_enhanced-adapter-1.6.7/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:1353:in `log'
/gems/2.2.0/gems/activerecord-oracle_enhanced-adapter-1.6.7/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb:121:in `exec_insert'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:108:in `insert'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/query_cache.rb:14:in `insert'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/relation.rb:64:in `insert'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/persistence.rb:524:in `_create_record'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/counter_cache.rb:139:in `_create_record'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/locking/optimistic.rb:75:in `_create_record'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/attribute_methods/dirty.rb:133:in `_create_record'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/callbacks.rb:306:in `block in _create_record'
/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in `_run_create_callbacks'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/callbacks.rb:306:in `_create_record'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/timestamp.rb:57:in `_create_record'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/persistence.rb:504:in `create_or_update'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/callbacks.rb:302:in `block in create_or_update'
/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in `_run_save_callbacks'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/callbacks.rb:302:in `create_or_update'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/persistence.rb:142:in `save!'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/validations.rb:43:in `save!'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:291:in `block in save!'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:220:in `transaction'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:291:in `save!'
/db/migrate/20081113061046_load_users_data.rb:43:in `up'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:571:in `up'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:611:in `exec_migration'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:592:in `block (2 levels) in migrate'
/2.2.0/benchmark.rb:288:in `measure'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:591:in `block in migrate'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:590:in `migrate'
C:in `migrate'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:1046:in `ddl_transaction'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:959:in `block in migrate'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `each'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `migrate'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:823:in `up'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:801:in `migrate'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/task.rb:248:in `call'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/task.rb:248:in `block in execute'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/task.rb:243:in `each'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/task.rb:243:in `execute'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
/2.2.0/monitor.rb:211:in `mon_synchronize'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/task.rb:180:in `invoke_with_call_chain'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/task.rb:173:in `invoke'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:150:in `invoke_task'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `each'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `block in top_level'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:115:in `run_with_threads'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:100:in `top_level'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:78:in `block in run'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:75:in `run'
bin/rake:4:in `<main>'
ActiveRecord::StatementInvalid: Encoding::UndefinedConversionError: U+7BA1 to WINDOWS-1252 in conversion from UTF-8 to WINDOWS-1252: INSERT INTO "USERS" ("ID", "LOGIN", "HASHED_PASSWORD", "SALT", "USER_NAME", "START_DATE", "END_DATE", "MAIL", "MAIL_NOTIFICATION", "CREATED_AT", "UPDATED_AT") VALUES (:a1, :a2, :a3, :a4, :a5, :a6, :a7, :a8, :a9, :a10, :a11)
/gems/2.2.0/gems/ruby-oci8-2.2.1-x86-mingw32/lib/oci8/bindtype.rb:121:in `encode'
/gems/2.2.0/gems/ruby-oci8-2.2.1-x86-mingw32/lib/oci8/bindtype.rb:121:in `create'
/gems/2.2.0/gems/ruby-oci8-2.2.1-x86-mingw32/lib/oci8/cursor.rb:504:in `make_bind_object'
/gems/2.2.0/gems/ruby-oci8-2.2.1-x86-mingw32/lib/oci8/cursor.rb:99:in `bind_param'
/gems/2.2.0/gems/activerecord-oracle_enhanced-adapter-1.6.7/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb:143:in `bind_param'
/gems/2.2.0/gems/activerecord-oracle_enhanced-adapter-1.6.7/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb:139:in `block (2 levels) in exec_insert'
/gems/2.2.0/gems/activerecord-oracle_enhanced-adapter-1.6.7/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb:132:in `each'
/gems/2.2.0/gems/activerecord-oracle_enhanced-adapter-1.6.7/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb:132:in `each_with_index'
/gems/2.2.0/gems/activerecord-oracle_enhanced-adapter-1.6.7/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb:132:in `block in exec_insert'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log'
/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `log'
/gems/2.2.0/gems/activerecord-oracle_enhanced-adapter-1.6.7/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:1353:in `log'
/gems/2.2.0/gems/activerecord-oracle_enhanced-adapter-1.6.7/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb:121:in `exec_insert'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:108:in `insert'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/query_cache.rb:14:in `insert'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/relation.rb:64:in `insert'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/persistence.rb:524:in `_create_record'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/counter_cache.rb:139:in `_create_record'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/locking/optimistic.rb:75:in `_create_record'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/attribute_methods/dirty.rb:133:in `_create_record'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/callbacks.rb:306:in `block in _create_record'
/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in `_run_create_callbacks'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/callbacks.rb:306:in `_create_record'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/timestamp.rb:57:in `_create_record'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/persistence.rb:504:in `create_or_update'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/callbacks.rb:302:in `block in create_or_update'
/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in `_run_save_callbacks'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/callbacks.rb:302:in `create_or_update'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/persistence.rb:142:in `save!'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/validations.rb:43:in `save!'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:291:in `block in save!'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:220:in `transaction'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:291:in `save!'
/db/migrate/20081113061046_load_users_data.rb:43:in `up'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:571:in `up'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:611:in `exec_migration'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:592:in `block (2 levels) in migrate'
/2.2.0/benchmark.rb:288:in `measure'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:591:in `block in migrate'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:590:in `migrate'
C:in `migrate'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:1046:in `ddl_transaction'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:959:in `block in migrate'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `each'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `migrate'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:823:in `up'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:801:in `migrate'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/task.rb:248:in `call'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/task.rb:248:in `block in execute'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/task.rb:243:in `each'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/task.rb:243:in `execute'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
/2.2.0/monitor.rb:211:in `mon_synchronize'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/task.rb:180:in `invoke_with_call_chain'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/task.rb:173:in `invoke'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:150:in `invoke_task'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `each'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `block in top_level'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:115:in `run_with_threads'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:100:in `top_level'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:78:in `block in run'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:75:in `run'
bin/rake:4:in `<main>'
Encoding::UndefinedConversionError: U+7BA1 to WINDOWS-1252 in conversion from UTF-8 to WINDOWS-1252
/gems/2.2.0/gems/ruby-oci8-2.2.1-x86-mingw32/lib/oci8/bindtype.rb:121:in `encode'
/gems/2.2.0/gems/ruby-oci8-2.2.1-x86-mingw32/lib/oci8/bindtype.rb:121:in `create'
/gems/2.2.0/gems/ruby-oci8-2.2.1-x86-mingw32/lib/oci8/cursor.rb:504:in `make_bind_object'
/gems/2.2.0/gems/ruby-oci8-2.2.1-x86-mingw32/lib/oci8/cursor.rb:99:in `bind_param'
/gems/2.2.0/gems/activerecord-oracle_enhanced-adapter-1.6.7/lib/active_record/connection_adapters/oracle_enhanced/oci_connection.rb:143:in `bind_param'
/gems/2.2.0/gems/activerecord-oracle_enhanced-adapter-1.6.7/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb:139:in `block (2 levels) in exec_insert'
/gems/2.2.0/gems/activerecord-oracle_enhanced-adapter-1.6.7/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb:132:in `each'
/gems/2.2.0/gems/activerecord-oracle_enhanced-adapter-1.6.7/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb:132:in `each_with_index'
/gems/2.2.0/gems/activerecord-oracle_enhanced-adapter-1.6.7/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb:132:in `block in exec_insert'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log'
/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `log'
/gems/2.2.0/gems/activerecord-oracle_enhanced-adapter-1.6.7/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:1353:in `log'
/gems/2.2.0/gems/activerecord-oracle_enhanced-adapter-1.6.7/lib/active_record/connection_adapters/oracle_enhanced/database_statements.rb:121:in `exec_insert'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:108:in `insert'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/query_cache.rb:14:in `insert'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/relation.rb:64:in `insert'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/persistence.rb:524:in `_create_record'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/counter_cache.rb:139:in `_create_record'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/locking/optimistic.rb:75:in `_create_record'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/attribute_methods/dirty.rb:133:in `_create_record'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/callbacks.rb:306:in `block in _create_record'
/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in `_run_create_callbacks'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/callbacks.rb:306:in `_create_record'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/timestamp.rb:57:in `_create_record'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/persistence.rb:504:in `create_or_update'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/callbacks.rb:302:in `block in create_or_update'
/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
/gems/2.2.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in `_run_save_callbacks'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/callbacks.rb:302:in `create_or_update'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/persistence.rb:142:in `save!'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/validations.rb:43:in `save!'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:291:in `block in save!'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:220:in `transaction'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:291:in `save!'
/db/migrate/20081113061046_load_users_data.rb:43:in `up'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:571:in `up'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:611:in `exec_migration'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:592:in `block (2 levels) in migrate'
/2.2.0/benchmark.rb:288:in `measure'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:591:in `block in migrate'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:590:in `migrate'
C:in `migrate'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:1046:in `ddl_transaction'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:959:in `block in migrate'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `each'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:955:in `migrate'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:823:in `up'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/migration.rb:801:in `migrate'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/gems/2.2.0/gems/activerecord-4.2.6/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/task.rb:248:in `call'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/task.rb:248:in `block in execute'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/task.rb:243:in `each'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/task.rb:243:in `execute'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
/2.2.0/monitor.rb:211:in `mon_synchronize'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/task.rb:180:in `invoke_with_call_chain'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/task.rb:173:in `invoke'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:150:in `invoke_task'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `each'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:106:in `block in top_level'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:115:in `run_with_threads'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:100:in `top_level'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:78:in `block in run'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:75:in `run'
bin/rake:4:in `<main>'
Tasks: TOP => db:migrate
My solution that works is:
in boot.rb, add this line of code:
ENV['NLS_LANG'] ||= 'AMERICAN_AMERICA.JA16SJIS'
This will tell activerecord or oracle_enhanced gem to save in database as SJIS encoding.
However, I have to say that the ActiveRecord::Fixtures still doesn't work. Fixtures still tries to insert into database as utf-8.
Look at my another question that still doesn't have an answer yet.
Fixtures: How to load utf-8 characters and convert to non utf-8 and save into database?
Final edit: fixtures also solved.

Can't migrate database after scaffold. Section 2.2 Ruby on Rails Tutorial Michael Hartl

I'm working through the Hartl ruby on rails tutorial (section 2.2), and I'm having trouble migrating the database. Everything seemed to be working, and then I ran rails generate scaffold User name:string email:string Afterwards I tried to run bundle exec rake db:migrate and got the below error message:
$ bundle exec rake db:migrate
== 20141125234257 CreateUsers: migrating ======================================
-- create_table(:users)
-> 0.0079s
== 20141125234257 CreateUsers: migrated (0.0080s) =============================
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
wrong number of arguments (1 for 0)/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract_adapter.rb:271:in `initialize'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract_adapter.rb:271:in `new'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract_adapter.rb:271:in `substitute_at'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/relation.rb:97:in `block in substitute_values'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/relation.rb:96:in `each'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/relation.rb:96:in `each_with_index'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/relation.rb:96:in `substitute_values'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/relation.rb:56:in `insert'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/persistence.rb:521:in `_create_record'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/counter_cache.rb:139:in `_create_record'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/attribute_methods/dirty.rb:122:in `_create_record'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/callbacks.rb:306:in `block in _create_record'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:88:in `call'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:88:in `_run_callbacks'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:734:in `_run_create_callbacks'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/callbacks.rb:306:in `_create_record'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/timestamp.rb:57:in `_create_record'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/persistence.rb:501:in `create_or_update'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/callbacks.rb:302:in `block in create_or_update'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:88:in `call'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:88:in `_run_callbacks'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:734:in `_run_save_callbacks'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/callbacks.rb:302:in `create_or_update'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/persistence.rb:142:in `save!'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/validations.rb:42:in `save!'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:289:in `block in save!'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:345:in `block in with_transaction_returning_status'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:218:in `transaction'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:342:in `with_transaction_returning_status'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:289:in `save!'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/persistence.rb:51:in `create!'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:1015:in `record_version_state_after_migrating'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:985:in `block in execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:1030:in `block in ddl_transaction'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:218:in `transaction'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:1030:in `ddl_transaction'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:983:in `execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:945:in `block in migrate'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:941:in `each'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:941:in `migrate'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:813:in `up'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:791:in `migrate'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
ArgumentError: wrong number of arguments (1 for 0)
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract_adapter.rb:271:in `initialize'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract_adapter.rb:271:in `new'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract_adapter.rb:271:in `substitute_at'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/relation.rb:97:in `block in substitute_values'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/relation.rb:96:in `each'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/relation.rb:96:in `each_with_index'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/relation.rb:96:in `substitute_values'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/relation.rb:56:in `insert'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/persistence.rb:521:in `_create_record'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/counter_cache.rb:139:in `_create_record'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/attribute_methods/dirty.rb:122:in `_create_record'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/callbacks.rb:306:in `block in _create_record'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:88:in `call'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:88:in `_run_callbacks'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:734:in `_run_create_callbacks'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/callbacks.rb:306:in `_create_record'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/timestamp.rb:57:in `_create_record'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/persistence.rb:501:in `create_or_update'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/callbacks.rb:302:in `block in create_or_update'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:88:in `call'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:88:in `_run_callbacks'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/callbacks.rb:734:in `_run_save_callbacks'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/callbacks.rb:302:in `create_or_update'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/persistence.rb:142:in `save!'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/validations.rb:42:in `save!'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:289:in `block in save!'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:345:in `block in with_transaction_returning_status'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:218:in `transaction'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:342:in `with_transaction_returning_status'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:289:in `save!'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/persistence.rb:51:in `create!'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:1015:in `record_version_state_after_migrating'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:985:in `block in execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:1030:in `block in ddl_transaction'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/transactions.rb:218:in `transaction'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:1030:in `ddl_transaction'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:983:in `execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:945:in `block in migrate'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:941:in `each'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:941:in `migrate'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:813:in `up'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/migration.rb:791:in `migrate'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activerecord-4.2.0.beta4/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
I've tried going back to an earlier commit and running everything again but I get the same error message. Are there any more files that I should add that can help with this?
I just ran into this as well. This is due to ActiveRecord 4.2.0.beta4 passing a parameter to Arel::Nodes::BindParam.new. Arel 6.0.0 was just released today. In this version, BindParam does not accept any parameters in it's initalizer.
ActiveRecord has already fixed this on the master branch. Until beta5 is released you'll need to lock your Gemfile to gem 'arel', '6.0.0.beta2'.
with above solution of changing gemfile.
gem 'arel', '6.0.0.beta2'
I got below error message.
You have requested:arel = 6.0.0.beta2
The bundle currently has arel locked at 6.0.0.
Try running `bundle update arel`
After
bundle update arel
it worked
I've solved this with
rake db:reset
After that
rake db:migrate
worked.

Rails validation error: Account can not be blank

I am receiving the following error when running my rake task:
Validation failed: Account can't be blank
This is the bit of code throwing the error:
test.entries.create!({
:account_id => account.id,
:date => date
})
My validation for both test and entries only validates the presence of :account_id. I know the error message is humanized to remove the .id, but it is obvious that :account_id exists. What am I missing here? I am using rails 3.1.14.
EDIT:
The full trace error is below-
rake aborted!
Validation failed: Account can't be blank
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/validations.rb:56:in `save!'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/attribute_methods/dirty.rb:33:in `save!'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/transactions.rb:264:in `block in save!'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/transactions.rb:208:in `transaction'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/transactions.rb:264:in `save!'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/associations/has_many_through_association.rb:85:in `save_through_record'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/associations/has_many_through_association.rb:52:in `insert_record'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/autosave_association.rb:348:in `block in save_collection_association'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/autosave_association.rb:341:in `each'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/autosave_association.rb:341:in `save_collection_association'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/autosave_association.rb:191:in `block in add_autosave_association_callbacks'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/autosave_association.rb:161:in `instance_eval'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/autosave_association.rb:161:in `block in define_non_cyclic_method'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:413:in `_run__3251750978270077373__create__1709181034843668520__callbacks'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:405:in `__run_callback'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:385:in `_run_create_callbacks'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/callbacks.rb:268:in `create'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/persistence.rb:348:in `create_or_update'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/callbacks.rb:264:in `block in create_or_update'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:447:in `_run__3251750978270077373__save__1709181034843668520__callbacks'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:405:in `__run_callback'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activesupport-3.2.14/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/callbacks.rb:264:in `create_or_update'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/persistence.rb:104:in `save!'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/validations.rb:56:in `save!'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/attribute_methods/dirty.rb:33:in `save!'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/transactions.rb:264:in `block in save!'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/transactions.rb:208:in `transaction'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/transactions.rb:264:in `save!'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/associations/has_many_association.rb:14:in `insert_record'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/associations/collection_association.rb:436:in `block (2 levels) in create_record'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/associations/collection_association.rb:344:in `add_to_target'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/associations/collection_association.rb:434:in `block in create_record'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/associations/collection_association.rb:149:in `block in transaction'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/transactions.rb:208:in `transaction'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/associations/collection_association.rb:148:in `transaction'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/associations/collection_association.rb:433:in `create_record'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/associations/collection_association.rb:123:in `create!'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/activerecord-3.2.14/lib/active_record/associations/collection_proxy.rb:46:in `create!'
/Users/Luigi/Desktop/Projects/test/lib/tasks/createnew.rake:179:in `block (5 levels) in <top (required)>'
/Users/Luigi/Desktop/Projects/test/lib/tasks/createnew.rake:165:in `each'
/Users/Luigi/Desktop/Projects/test/lib/tasks/createnew.rake:165:in `block (4 levels) in <top (required)>'
/Users/Luigi/Desktop/Projects/test/lib/tasks/createnew.rake:90:in `upto'
/Users/Luigi/Desktop/Projects/test/lib/tasks/createnew.rake:90:in `block (3 levels) in <top (required)>'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/Luigi/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
/Users/Luigi/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/bin/rake:19:in `load'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/bin/rake:19:in `<main>'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/bin/ruby_noexec_wrapper:14:in `eval'
/Users/Luigi/.rvm/gems/ruby-1.9.3-p429#test/bin/ruby_noexec_wrapper:14:in `<main>'
The particular line of code mentioned above is on line 179, and it is inside a loop that starts on line 165, which is inside a loop that starts on line 90.
Try to add the following in your model:
attr_accessible :account
or
attr_accessible :account_id
depending on your needs.
test.entries.create!(account_id: account.id)
is the same as (assuming there is a "relation"):
test.entries.create!(account: account)

Google-maps-for-Rails - undefined method `gmaps' for (object) in rake task

When I run a rake task that involves a model with gmaps4rails enabled I get this error, and if I comment the model so it's not acts_as_gmappable it completes properly.
enter code here
troy$ rake populate:scans --trace
** Invoke populate:scans (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute populate:scans
http://goo.gl/fb/977ze
Sat, 16 Jul 2011 19:43:59 GMT
47.676506
-122.121872
91df0f32209c5212XXXXXXXXXXXXXXX
rake aborted!
undefined method `gmaps' for #<Scan:0x000001051fb9a8>
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activemodel-3.0.9/lib/active_model/attribute_methods.rb:392:in `method_missing'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/attribute_methods.rb:46:in `method_missing'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/gmaps4rails-0.9.1/lib/gmaps4rails/acts_as_gmappable.rb:12:in `process_geocoding'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.9/lib/active_support/callbacks.rb:415:in `_run_validate_callbacks'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activemodel-3.0.9/lib/active_model/validations.rb:212:in `run_validations!'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activemodel-3.0.9/lib/active_model/validations/callbacks.rb:67:in `block in run_validations!'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.9/lib/active_support/callbacks.rb:414:in `_run_validation_callbacks'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activemodel-3.0.9/lib/active_model/validations/callbacks.rb:67:in `run_validations!'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activemodel-3.0.9/lib/active_model/validations.rb:179:in `valid?'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/validations.rb:55:in `valid?'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/validations.rb:75:in `perform_validations'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/validations.rb:43:in `save'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/attribute_methods/dirty.rb:21:in `save'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/transactions.rb:240:in `block (2 levels) in save'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/transactions.rb:292:in `block in with_transaction_returning_status'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/transactions.rb:207:in `transaction'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/transactions.rb:290:in `with_transaction_returning_status'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/transactions.rb:240:in `block in save'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/transactions.rb:251:in `rollback_active_record_state!'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.9/lib/active_record/transactions.rb:239:in `save'
/Users/troy/Documents/projects/qrbrowser/lib/tasks/populate.rake:42:in `block (3 levels) in <top (required)>'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/nokogiri-1.5.0/lib/nokogiri/xml/node_set.rb:239:in `block in each'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/nokogiri-1.5.0/lib/nokogiri/xml/node_set.rb:238:in `upto'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/nokogiri-1.5.0/lib/nokogiri/xml/node_set.rb:238:in `each'
/Users/troy/Documents/projects/qrbrowser/lib/tasks/populate.rake:23:in `block (2 levels) in <top (required)>'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/troy/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `load'
/Users/troy/.rvm/gems/ruby-1.9.2-p180/bin/rake:19:in `<main>'
Tasks: TOP => populate:scans
Solution 1:
acts_as_gmappable :process_geocoding => false
Solution 2:
When you're creating an instance of your model, do:
#scan.instance_eval do
def process_geocoding
true
end
end

Resources