Create Object With Parallel Gem - ruby-on-rails

I'm trying to introduce some concurrency into my project.
I'm playing with the parallel gem now, and am having a problem creating an object inside of a parallel process.
Parallel.map(["a"], :in_processes => 8) do |i|
ActiveRecord::Base.connection_pool.with_connection do
User.create
end
end
Results in:
/Users/tyler/.rvm/gems/ruby-1.9.3-p392#arcsite_mysql/gems/parallel-0.8.1/lib/parallel.rb:279:in `dump': no _dump_data is defined for class Binding (TypeError)
from /Users/tyler/.rvm/gems/ruby-1.9.3-p392#arcsite_mysql/gems/parallel-0.8.1/lib/parallel.rb:279:in `process_incoming_jobs'
from /Users/tyler/.rvm/gems/ruby-1.9.3-p392#arcsite_mysql/gems/parallel-0.8.1/lib/parallel.rb:257:in `block in worker'
from /Users/tyler/.rvm/gems/ruby-1.9.3-p392#arcsite_mysql/gems/parallel-0.8.1/lib/parallel.rb:250:in `fork'
from /Users/tyler/.rvm/gems/ruby-1.9.3-p392#arcsite_mysql/gems/parallel-0.8.1/lib/parallel.rb:250:in `worker'
from /Users/tyler/.rvm/gems/ruby-1.9.3-p392#arcsite_mysql/gems/parallel-0.8.1/lib/parallel.rb:238:in `block in create_workers'
from /Users/tyler/.rvm/gems/ruby-1.9.3-p392#arcsite_mysql/gems/parallel-0.8.1/lib/parallel.rb:237:in `each'
from /Users/tyler/.rvm/gems/ruby-1.9.3-p392#arcsite_mysql/gems/parallel-0.8.1/lib/parallel.rb:237:in `create_workers'
from /Users/tyler/.rvm/gems/ruby-1.9.3-p392#arcsite_mysql/gems/parallel-0.8.1/lib/parallel.rb:201:in `work_in_processes'
from /Users/tyler/.rvm/gems/ruby-1.9.3-p392#arcsite_mysql/gems/parallel-0.8.1/lib/parallel.rb:106:in `map'
from (irb):15:in `irb_binding'
from /Users/tyler/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb/workspace.rb:80:in `eval'
from /Users/tyler/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb/workspace.rb:80:in `evaluate'
from /Users/tyler/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb/context.rb:254:in `evaluate'
from /Users/tyler/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb.rb:159:in `block (2 levels) in eval_input'
from /Users/tyler/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb.rb:273:in `signal_status'
from /Users/tyler/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb.rb:156:in `block in eval_input'
from /Users/tyler/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb/ruby-lex.rb:243:in `block (2 levels) in each_top_level_statement'
from /Users/tyler/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `loop'
from /Users/tyler/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `block in each_top_level_statement'
from /Users/tyler/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb/ruby-lex.rb:228:in `catch'
from /Users/tyler/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb/ruby-lex.rb:228:in `each_top_level_statement'
from /Users/tyler/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb.rb:155:in `eval_input'
from /Users/tyler/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb.rb:70:in `block in start'
from /Users/tyler/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb.rb:69:in `catch'
from /Users/tyler/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb.rb:69:in `start'
from /Users/tyler/.rvm/gems/ruby-1.9.3-p392#arcsite_mysql/gems/railties-3.2.13/lib/rails/commands/console.rb:47:in `start'
from /Users/tyler/.rvm/gems/ruby-1.9.3-p392#arcsite_mysql/gems/railties-3.2.13/lib/rails/commands/console.rb:8:in `start'
from /Users/tyler/.rvm/gems/ruby-1.9.3-p392#arcsite_mysql/gems/railties-3.2.13/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Parallel::DeadWorker: Parallel::DeadWorker
from /Users/tyler/.rvm/gems/ruby-1.9.3-p392#arcsite_mysql/gems/parallel-0.8.1/lib/parallel.rb:51:in `rescue in work'
from /Users/tyler/.rvm/gems/ruby-1.9.3-p392#arcsite_mysql/gems/parallel-0.8.1/lib/parallel.rb:48:in `work'
from /Users/tyler/.rvm/gems/ruby-1.9.3-p392#arcsite_mysql/gems/parallel-0.8.1/lib/parallel.rb:216:in `block (4 levels) in work_in_processes'
from /Users/tyler/.rvm/gems/ruby-1.9.3-p392#arcsite_mysql/gems/parallel-0.8.1/lib/parallel.rb:352:in `with_instrumentation'
from /Users/tyler/.rvm/gems/ruby-1.9.3-p392#arcsite_mysql/gems/parallel-0.8.1/lib/parallel.rb:215:in `block (3 levels) in work_in_processes'
from /Users/tyler/.rvm/gems/ruby-1.9.3-p392#arcsite_mysql/gems/parallel-0.8.1/lib/parallel.rb:210:in `loop'
from /Users/tyler/.rvm/gems/ruby-1.9.3-p392#arcsite_mysql/gems/parallel-0.8.1/lib/parallel.rb:210:in `block (2 levels) in work_in_processes'
from /Users/tyler/.rvm/gems/ruby-1.9.3-p392#arcsite_mysql/gems/parallel-0.8.1/lib/parallel.rb:65:in `block (2 levels) in in_threads'
Any variation of the parallel block seems to result in the same error. Removing the call to create allows the program to function as expected.

Looks like what you are returning is not dumpable, so either return nil or use Parallel.each alternatively Maybe the with_connection does not actually return the user object but something weird ... You can also try to return user.attributes instead of the full user object

http://ruby.zigzo.com/2012/01/29/the-parallel-gem-and-postgresql-oh-and-rails/
According to the above Mario's post, PostgreSQL does not allow using the same connection for more than one thread. I am wondering if the MySQL is the same, plus MySQL may put lock while accessing it. Here is the solution for parallel working on PostgreSQL: ActiveRecord::Base.connection.reconnect!

Related

Rails: Rake gives Zeitwerk error when mentioning one model class in another

So I'm having a really weird rails problem (6.1.4). Everything runs fine in normal operation but when I try to use some of my models from inside a rake task (e.g. code in seeds.rb) I get the following error: TypeError: superclass mismatch for class Comment
After doing a bunch of digging, I've narrowed the culprit down to the fact that inside one of my model classes I reference the name of another. Specifically, the following code suffices to create the problem
class Question < ApplicationRecord
include JsonHelpers
include PostableHelpers
puts "#{Comment.inspect}"
end
Note that the error still happens when I comment out the whole body of the Comment class so it is just
class Comment < ApplicationRecord
end
Where Comment is another model (in models/comment.rb inheriting from ApplicationRecord). If I delete the reference to Comment in Question there is no problem (but any such reference causes the issue), nor is there a problem when I simply respond to web requests. (In my real code I have a class macro which creates a polymorphic belongs_to and takes the allowed related classes to define some utility methods and validation).
It feels like it's some kind of problem with loading constants but I have no idea how to go about fixing it. Even a simple pointer in the right direction would be super helpful.
I've included the whole error below for completeness. I'm happy to add more code if it helps, but short of just posting the whole application I'm not sure what would be relevant.
/Users/TruePath/Build/math-site/app/models/comment.rb:1:in `<main>'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:27:in `require'
/Users/TruePath/Build/math-site/app/models/question.rb:8:in `<class:Question>'
/Users/TruePath/Build/math-site/app/models/question.rb:1:in `<main>'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:27:in `require'
/Users/TruePath/Build/math-site/app/models/post.rb:18:in `<class:Post>'
/Users/TruePath/Build/math-site/app/models/post.rb:1:in `<main>'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:27:in `require'
/Users/TruePath/Build/math-site/app/models/tagging.rb:5:in `<class:Tagging>'
/Users/TruePath/Build/math-site/app/models/tagging.rb:1:in `<main>'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:27:in `require'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activesupport-6.1.4/lib/active_support/inflector/methods.rb:288:in `const_get'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activesupport-6.1.4/lib/active_support/inflector/methods.rb:288:in `block in constantize'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activesupport-6.1.4/lib/active_support/inflector/methods.rb:284:in `each'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activesupport-6.1.4/lib/active_support/inflector/methods.rb:284:in `inject'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activesupport-6.1.4/lib/active_support/inflector/methods.rb:284:in `constantize'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activesupport-6.1.4/lib/active_support/inflector/methods.rb:330:in `safe_constantize'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activesupport-6.1.4/lib/active_support/dependencies/zeitwerk_integration.rb:23:in `safe_constantize'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activerecord-6.1.4/lib/active_record/inheritance.rb:230:in `block in compute_type'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activerecord-6.1.4/lib/active_record/inheritance.rb:229:in `each'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activerecord-6.1.4/lib/active_record/inheritance.rb:229:in `compute_type'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activerecord-6.1.4/lib/active_record/reflection.rb:409:in `compute_class'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activerecord-6.1.4/lib/active_record/reflection.rb:366:in `klass'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activerecord-6.1.4/lib/active_record/reflection.rb:791:in `source_reflection'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activerecord-6.1.4/lib/active_record/reflection.rb:932:in `check_validity!'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activerecord-6.1.4/lib/active_record/associations/association.rb:41:in `initialize'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activerecord-6.1.4/lib/active_record/associations/has_many_through_association.rb:10:in `initialize'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activerecord-6.1.4/lib/active_record/associations.rb:315:in `new'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activerecord-6.1.4/lib/active_record/associations.rb:315:in `association'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activerecord-6.1.4/lib/active_record/associations/builder/association.rb:103:in `tags'
/Users/TruePath/Build/math-site/app/models/page.rb:207:in `update_history'
/Users/TruePath/Build/math-site/app/models/page.rb:101:in `build_by_user'
/Users/TruePath/Build/math-site/db/seeds.rb:99:in `block in <main>'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activerecord-6.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `block in transaction'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activerecord-6.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activesupport-6.1.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activesupport-6.1.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activesupport-6.1.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activesupport-6.1.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activesupport-6.1.4/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activerecord-6.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activerecord-6.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `transaction'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activerecord-6.1.4/lib/active_record/transactions.rb:209:in `transaction'
/Users/TruePath/Build/math-site/db/seeds.rb:84:in `<main>'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:48:in `load'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:48:in `load'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/railties-6.1.4/lib/rails/engine.rb:566:in `block in load_seed'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activesupport-6.1.4/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activesupport-6.1.4/lib/active_support/execution_wrapper.rb:88:in `wrap'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/railties-6.1.4/lib/rails/engine.rb:640:in `block (2 levels) in <class:Engine>'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activesupport-6.1.4/lib/active_support/callbacks.rb:126:in `instance_exec'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activesupport-6.1.4/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activesupport-6.1.4/lib/active_support/callbacks.rb:137:in `run_callbacks'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/railties-6.1.4/lib/rails/engine.rb:566:in `load_seed'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activerecord-6.1.4/lib/active_record/tasks/database_tasks.rb:450:in `load_seed'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/activerecord-6.1.4/lib/active_record/railties/databases.rake:392:in `block (2 levels) in <main>'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:83:in `block in run'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/rake-13.0.6/lib/rake/application.rb:80:in `run'
/opt/local/lib/ruby3.1/gems/3.1.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/opt/local/bin/rake:25:in `load'
/opt/local/bin/rake:25:in `<main>'
/opt/local/bin/ruby_executable_hooks3.1:22:in `eval'
/opt/local/bin/ruby_executable_hooks3.1:22:in `<main>'
Tasks: TOP => db:seed
Ok, thanks to the amazing help by Xavier Noria I finally tracked it down. I'll include the answer here in case anyone else runs into the problem.
Ultimately, the issues was that I had a rake task that was defined as follows:
require 'rexml/document'
include REXML
namespace :db do
desc "Delete all unconfirmed users after 1 day"
task :import_journal_abbrevs => :environment do
...
end
Unfortunately, REXML defines a class named Comment which was conflicting with my model class of the same name. As this answer warns placing the include at the top level pollutes the Object namespace. Instead, I should have written
require 'rexml/document'
namespace :db do
desc "Delete all unconfirmed users after 1 day"
task :import_journal_abbrevs => :environment do
include REXML
...
end

invalid byte sequence in UTF-8 (ArgumentError) when using arrow keys in the console

When using the arrow keys in my rails console inside my docker container the following error happens, and afterwards the console shuts down.
It isn't related to my .irb_history containing odd characters as I don't have one, and it happens even with the left/right arrow keys.
irb(main):001:0> /usr/local/bundle/gems/rb-readline-0.4.2/lib/rbreadline.rb:4269:in `block in _rl_dispatch_subseq': invalid byte sequence in UTF-8 (ArgumentError)
from /usr/local/bundle/gems/rb-readline-0.4.2/lib/rbreadline.rb:4269:in `each'
from /usr/local/bundle/gems/rb-readline-0.4.2/lib/rbreadline.rb:4269:in `detect'
from /usr/local/bundle/gems/rb-readline-0.4.2/lib/rbreadline.rb:4269:in `_rl_dispatch_subseq'
from /usr/local/bundle/gems/rb-readline-0.4.2/lib/rbreadline.rb:4271:in `_rl_dispatch_subseq'
from /usr/local/bundle/gems/rb-readline-0.4.2/lib/rbreadline.rb:4251:in `_rl_dispatch'
from /usr/local/bundle/gems/rb-readline-0.4.2/lib/rbreadline.rb:4669:in `readline_internal_charloop'
from /usr/local/bundle/gems/rb-readline-0.4.2/lib/rbreadline.rb:4743:in `readline_internal'
from /usr/local/bundle/gems/rb-readline-0.4.2/lib/rbreadline.rb:4765:in `readline'
from /usr/local/bundle/gems/rb-readline-0.4.2/lib/readline.rb:40:in `readline'
from /usr/local/lib/ruby/2.4.0/irb/input-method.rb:151:in `gets'
from /usr/local/lib/ruby/2.4.0/irb.rb:473:in `block (2 levels) in eval_input'
from /usr/local/lib/ruby/2.4.0/irb.rb:627:in `signal_status'
from /usr/local/lib/ruby/2.4.0/irb.rb:472:in `block in eval_input'
from /usr/local/lib/ruby/2.4.0/irb/ruby-lex.rb:189:in `buf_input'
from /usr/local/lib/ruby/2.4.0/irb/ruby-lex.rb:104:in `getc'
from /usr/local/lib/ruby/2.4.0/irb/slex.rb:206:in `match_io'
from /usr/local/lib/ruby/2.4.0/irb/slex.rb:76:in `match'
from /usr/local/lib/ruby/2.4.0/irb/ruby-lex.rb:283:in `token'
from /usr/local/lib/ruby/2.4.0/irb/ruby-lex.rb:265:in `lex'
from /usr/local/lib/ruby/2.4.0/irb/ruby-lex.rb:236:in `block (2 levels) in each_top_level_statement'
from /usr/local/lib/ruby/2.4.0/irb/ruby-lex.rb:232:in `loop'
from /usr/local/lib/ruby/2.4.0/irb/ruby-lex.rb:232:in `block in each_top_level_statement'
from /usr/local/lib/ruby/2.4.0/irb/ruby-lex.rb:231:in `catch'
from /usr/local/lib/ruby/2.4.0/irb/ruby-lex.rb:231:in `each_top_level_statement'
from /usr/local/lib/ruby/2.4.0/irb.rb:489:in `eval_input'
from /usr/local/lib/ruby/2.4.0/irb.rb:430:in `block in run'
from /usr/local/lib/ruby/2.4.0/irb.rb:429:in `catch'
from /usr/local/lib/ruby/2.4.0/irb.rb:429:in `run'
from /usr/local/lib/ruby/2.4.0/irb.rb:385:in `start'
from /usr/local/bundle/gems/railties-4.2.11.1/lib/rails/commands/console.rb:110:in `start'
from /usr/local/bundle/gems/railties-4.2.11.1/lib/rails/commands/console.rb:9:in `start'
from /usr/local/bundle/gems/railties-4.2.11.1/lib/rails/commands/commands_tasks.rb:68:in `console'
from /usr/local/bundle/gems/railties-4.2.11.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /usr/local/bundle/gems/railties-4.2.11.1/lib/rails/commands.rb:17:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I tried using another terminal (zsh), running ruby 2.6.6, as well as setting the following ENVS with no success.
export LC_ALL=C.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
Where else could I be looking at?

Segfault after creating instance of model in console

I have the following model in my Rails application:
class Window < Gosu::Window
def initialize
super( 250, 100, false )
#background_image = Gosu::Image.new( self, 'hello.png' )
end
def draw
#background_image.draw( 0, 0, 1 )
end
def button_down(id)
close
end
end
As you can see, the model is basically a "hello world" for launching a Gosu library window. I got the idea off "Ruby Tips #336 – Turn Rails into a Game Engine". The problem begins when I do the following:
$ rails console
2.2.1 :001> win = Window.new
Immediately after I press enter I get a segmentation fault with the following stack trace:
/Users/giancarloguerra/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Users/giancarloguerra/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/spring-1.4.4/lib/spring/application/boot.rb:18:in `<top (required)>'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/spring-1.4.4/lib/spring/application.rb:125:in `run'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/spring-1.4.4/lib/spring/application.rb:125:in `loop'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/spring-1.4.4/lib/spring/application.rb:131:in `block in run'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/spring-1.4.4/lib/spring/application.rb:156:in `serve'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/spring-1.4.4/lib/spring/application.rb:156:in `fork'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/spring-1.4.4/lib/spring/application.rb:183:in `block in serve'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/spring-1.4.4/lib/spring/command_wrapper.rb:38:in `call'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/spring-1.4.4/lib/spring/commands/rails.rb:6:in `call'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in `load'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:240:in `load_dependency'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in `block in load'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in `load'
/Users/giancarloguerra/Desktop/testgosu/bin/rails:9:in `<top (required)>'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `require'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:240:in `load_dependency'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `block in require'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `require'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:68:in `console'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands/console.rb:9:in `start'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands/console.rb:110:in `start'
/Users/giancarloguerra/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/irb.rb:394:in `start'
/Users/giancarloguerra/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/irb.rb:394:in `catch'
/Users/giancarloguerra/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/irb.rb:395:in `block in start'
/Users/giancarloguerra/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/irb.rb:485:in `eval_input'
/Users/giancarloguerra/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/irb/ruby-lex.rb:230:in `each_top_level_statement'
/Users/giancarloguerra/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/irb/ruby-lex.rb:230:in `catch'
/Users/giancarloguerra/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/irb/ruby-lex.rb:231:in `block in each_top_level_statement'
/Users/giancarloguerra/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/irb/ruby-lex.rb:231:in `loop'
/Users/giancarloguerra/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/irb/ruby-lex.rb:245:in `block (2 levels) in each_top_level_statement'
/Users/giancarloguerra/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/irb.rb:486:in `block in eval_input'
/Users/giancarloguerra/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/irb.rb:623:in `signal_status'
/Users/giancarloguerra/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/irb.rb:489:in `block (2 levels) in eval_input'
/Users/giancarloguerra/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/irb/context.rb:379:in `evaluate'
/Users/giancarloguerra/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/irb/workspace.rb:86:in `evaluate'
/Users/giancarloguerra/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/irb/workspace.rb:86:in `eval'
(irb):1:in `irb_binding'
(irb):1:in `new'
/Users/giancarloguerra/Desktop/testgosu/app/models/window.rb:5:in `initialize'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/gosu-0.10.4/lib/gosu/swig_patches.rb:19:in `initialize'
/Users/giancarloguerra/.rvm/gems/ruby-2.2.1/gems/gosu-0.10.4/lib/gosu/swig_patches.rb:19:in `initialize'
Along with information on the loaded features from the console. In the end, the console tells me that I may have found a bug and that I should report it.
Here's what I have done about it:
Checked gosu gem is installed. It is.
Debugged my program.
Followed the stack trace for any remote clues.
I'm all out of ideas here. Any suggestions as to what could be happening? I appreciate your help.
It turns out that the 'Spring' gem was causing the issues. After I removed that, the window executed :)

invalid byte sequence in UTF-8 (ArgumentError) calabash-cucumber

After following the fast track setup guide for calabash-ios without any issues I receive an error when trying to run cucumber in the project folder. I receive the following error with verbose and backtrack flags
Code:
* features/support/env.rb
* features/support/01_launch.rb
* features/support/02_pre_stop_hooks.rb
* features/step_definitions/calabash_steps.rb
* features/step_definitions/my_first_steps.rb
Features:
* features/my_first.feature
Parsing feature files took 0m0.003s
Feature: Running a test
As an iOS developer
I want to have a sample feature file
So I can begin testing quickly
Scenario: Example steps # features/my_first.feature:6
invalid byte sequence in UTF-8 (ArgumentError)
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/run_loop-1.4.1/lib/run_loop/instruments.rb:162:in `split'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/run_loop-1.4.1/lib/run_loop/instruments.rb:162:in `block in pids_from_ps_output'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/run_loop-1.4.1/lib/run_loop/instruments.rb:161:in `map'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/run_loop-1.4.1/lib/run_loop/instruments.rb:161:in `pids_from_ps_output'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/run_loop-1.4.1/lib/run_loop/instruments.rb:15:in `instruments_pids'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/run_loop-1.4.1/lib/run_loop/instruments.rb:39:in `kill_instruments'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/run_loop-1.4.1/lib/run_loop/core.rb:178:in `run_with_options'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/run_loop-1.4.1/lib/run_loop.rb:82:in `run'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/calabash-cucumber-0.14.3/lib/calabash-cucumber/launcher.rb:755:in `block in new_run_loop'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/calabash-cucumber-0.14.3/lib/calabash-cucumber/launcher.rb:753:in `times'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/calabash-cucumber-0.14.3/lib/calabash-cucumber/launcher.rb:753:in `new_run_loop'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/calabash-cucumber-0.14.3/lib/calabash-cucumber/launcher.rb:631:in `relaunch'
/Users/magnusm/Developer/Aubjorg-3.6_UITEST/Audbjorg/features/support/01_launch.rb:27:in `block in <top (required)>'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/core_ext/instance_exec.rb:48:in `instance_exec'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/core_ext/instance_exec.rb:48:in `block in cucumber_instance_exec'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/core_ext/instance_exec.rb:69:in `cucumber_run_with_backtrace_filtering'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/core_ext/instance_exec.rb:36:in `cucumber_instance_exec'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/rb_support/rb_hook.rb:14:in `invoke'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/language_support/language_methods.rb:114:in `invoke'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/language_support/language_methods.rb:102:in `block in execute_before'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/language_support/language_methods.rb:101:in `each'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/language_support/language_methods.rb:101:in `execute_before'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/language_support/language_methods.rb:15:in `before'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime/support_code.rb:112:in `block in fire_hook'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime/support_code.rb:111:in `each'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime/support_code.rb:111:in `fire_hook'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime.rb:107:in `before'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime.rb:98:in `before_and_after'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime.rb:82:in `block in with_hooks'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime/support_code.rb:120:in `call'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime/support_code.rb:120:in `block (3 levels) in around'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/language_support/language_methods.rb:9:in `block in around'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/language_support/language_methods.rb:97:in `call'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/language_support/language_methods.rb:97:in `execute_around'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/language_support/language_methods.rb:8:in `around'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime/support_code.rb:119:in `block (2 levels) in around'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime/support_code.rb:123:in `call'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime/support_code.rb:123:in `around'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime.rb:94:in `around'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime.rb:81:in `with_hooks'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/tree_walker.rb:13:in `execute'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/scenario.rb:32:in `block in accept'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/scenario.rb:79:in `with_visitor'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/scenario.rb:31:in `accept'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/tree_walker.rb:58:in `block in visit_feature_element'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/tree_walker.rb:170:in `broadcast'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/tree_walker.rb:57:in `visit_feature_element'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/feature.rb:38:in `block in accept'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/feature.rb:37:in `each'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/feature.rb:37:in `accept'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/tree_walker.rb:27:in `block in visit_feature'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/tree_walker.rb:170:in `broadcast'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/tree_walker.rb:26:in `visit_feature'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/features.rb:28:in `block in accept'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/features.rb:17:in `each'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/features.rb:17:in `each'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/features.rb:27:in `accept'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/tree_walker.rb:21:in `block in visit_features'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/tree_walker.rb:170:in `broadcast'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/ast/tree_walker.rb:20:in `visit_features'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/runtime.rb:49:in `run!'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/lib/cucumber/cli/main.rb:47:in `execute!'
/usr/local/var/rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/cucumber-1.3.20/bin/cucumber:13:in `<top (required)>'
/usr/local/var/rbenv/versions/2.2.3/bin/cucumber:23:in `load'
/usr/local/var/rbenv/versions/2.2.3/bin/cucumber:23:in `<main>'
Given I am on the Welcome Screen # features/step_definitions/my_first_steps.rb:1
Then I swipe left # calabash-cucumber-0.14.3/features/step_definitions/calabash_steps.rb:222
And I wait until I don't see "Please swipe left" # calabash-cucumber-0.14.3/features/step_definitions/calabash_steps.rb:158
And take picture # calabash-cucumber-0.14.3/features/step_definitions/calabash_steps.rb:217
Failing Scenarios:
cucumber features/my_first.feature:6 # Scenario: Example steps
1 scenario (1 failed)
4 steps (4 skipped)
0m0.226s
How can I solve this issue ?
UPDATE Fixed in run-loop develop.
There is a bug in run-loop.
"Dilbert’s MacBook Pro [<UDID>]"
$ perl -ane '{ if(m/[[:^ascii:]]/) { print } }' devices.txt
Dilbert’s MacBook Pro [<UDID>]
The apostrophe in that string is causing the problem. It is a UTF8 character and not ASCII.
Workaround Rename your machine in System Preferences > Sharing.
Tracking https://github.com/calabash/run_loop/issues/219
Related https://github.com/calabash/run_loop/issues/74
Thanks to Magnus Olafur for helping me track this down.

Error on Rails Admin install. Possibly Devise related?

Sorry to copy in this entire log, but I'm hoping it might make more sense to someone familiar with this issue. When devise began setting up the user model I wasn't given the option (I never pressed enter) and the install proceeded and crashed, outputting the following. Thanks!
? What would you like the user model to be called? Press <enter> for [user] > - Now setting up devise with user model name 'user':
generate devise
invoke active_record
create db/migrate/20120825075751_add_devise_to_users.rb
insert app/models/user.rb
route devise_for :users
- Now you'll need an initializer...
create config/initializers/rails_admin.rb
/home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/activerecord-3.2.8/lib/active_record/reflection.rb:385:in `block in source_reflection': undefined method `klass' for nil:NilClass (NoMethodError)
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/activerecord-3.2.8/lib/active_record/reflection.rb:385:in `collect'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/activerecord-3.2.8/lib/active_record/reflection.rb:385:in `source_reflection'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/activerecord-3.2.8/lib/active_record/reflection.rb:375:in `rescue in foreign_key'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/activerecord-3.2.8/lib/active_record/reflection.rb:373:in `foreign_key'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/adapters/active_record.rb:259:in `association_foreign_key_lookup'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/adapters/active_record.rb:71:in `block in associations'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/adapters/active_record.rb:64:in `map'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/adapters/active_record.rb:64:in `associations'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/abstract_model.rb:29:in `block (2 levels) in polymorphic_parents'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/abstract_model.rb:28:in `each'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/abstract_model.rb:28:in `block in polymorphic_parents'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/abstract_model.rb:27:in `tap'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/abstract_model.rb:27:in `polymorphic_parents'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/adapters/active_record.rb:222:in `association_model_lookup'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/adapters/active_record.rb:69:in `block (2 levels) in associations'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/config/fields/types/polymorphic_association.rb:49:in `call'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/config/fields/types/polymorphic_association.rb:49:in `associated_model_config'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/config/fields/types/polymorphic_association.rb:19:in `block in <class:PolymorphicAssociation>'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/config/configurable.rb:68:in `instance_eval'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/config/configurable.rb:68:in `block in register_instance_option'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/rails_admin/config/configurable.rb:42:in `block in register_instance_option'
from (erb):86:in `block (2 levels) in template'
from (erb):85:in `map'
from (erb):85:in `block in template'
from (erb):82:in `map'
from (erb):82:in `template'
from /home/funkdified/.rvm/rubies/ruby-1.9.3-p125-HEAD/lib/ruby/1.9.1/erb.rb:838:in `eval'
from /home/funkdified/.rvm/rubies/ruby-1.9.3-p125-HEAD/lib/ruby/1.9.1/erb.rb:838:in `result'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions/file_manipulation.rb:111:in `block in template'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions/create_file.rb:54:in `call'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions/create_file.rb:54:in `render'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions/create_file.rb:63:in `block (2 levels) in invoke!'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions/create_file.rb:63:in `open'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions/create_file.rb:63:in `block in invoke!'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions/empty_directory.rb:133:in `call'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions/empty_directory.rb:133:in `invoke_with_conflict_check'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions/create_file.rb:61:in `invoke!'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions.rb:95:in `action'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions/create_file.rb:26:in `create_file'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/actions/file_manipulation.rb:110:in `template'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/rails_admin-0.0.5/lib/generators/rails_admin/install_generator.rb:59:in `install'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/task.rb:27:in `run'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/invocation.rb:120:in `invoke_task'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `block in invoke_all'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `each'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `map'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `invoke_all'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/group.rb:238:in `dispatch'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/thor-0.16.0/lib/thor/base.rb:425:in `start'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/railties-3.2.8/lib/rails/generators.rb:171:in `invoke'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/railties-3.2.8/lib/rails/commands/generate.rb:12:in `<top (required)>'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /home/funkdified/.rvm/gems/ruby-1.9.3-p125-HEAD#rails323/gems/railties-3.2.8/lib/rails/commands.rb:29:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I figured it out. I installed devise first to debug and found it was an issue with my existing User model. I needed to drop the User table and start over.

Resources