Unwanted lines in rails console error reporting - ruby-on-rails

?> error
NameError: undefined local variable or method `error' for main:Object
from (irb):7
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/railties-4.2.0.beta4/lib/rails/commands/console.rb:110:in `start'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/railties-4.2.0.beta4/lib/rails/commands/console.rb:9:in `start'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/railties-4.2.0.beta4/lib/rails/commands/commands_tasks.rb:68:in `console'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/railties-4.2.0.beta4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/railties-4.2.0.beta4/lib/rails/commands.rb:17:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:252:in `require'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:252:in `block in require'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:237:in `load_dependency'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:252:in `require'
from /home/ubuntu/workspace/sample_app/bin/rails:8:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:246:in `load'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:246:in `block in load'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:237:in `load_dependency'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/activesupport-4.2.0.beta4/lib/active_support/dependencies.rb:246:in `load'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/spring-1.1.3/lib/spring/commands/rails.rb:6:in `call'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/spring-1.1.3/lib/spring/command_wrapper.rb:38:in `call'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/spring-1.1.3/lib/spring/application.rb:180:in `block in serve'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/spring-1.1.3/lib/spring/application.rb:153:in `fork'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/spring-1.1.3/lib/spring/application.rb:153:in `serve'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/spring-1.1.3/lib/spring/application.rb:128:in `block in run'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/spring-1.1.3/lib/spring/application.rb:122:in `loop'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/spring-1.1.3/lib/spring/application.rb:122:in `run'
from /usr/local/rvm/gems/ruby-2.1.4#rails4/gems/spring-1.1.3/lib/spring/application/boot.rb:18:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-2.1.4/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/local/rvm/rubies/ruby-2.1.4/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
In rails console when I commit an error, the console displays tons of lines which I don't want to see. Can this be silenced?
I've found that you can add this line:
Rails.backtrace_cleaner.add_silencer { |line| line =~ /rvm/ }
in config/initializers/backtrace_silencers.rb but this doesn't resolve the problem.

Related

How to fix 'rails aborted' error when running "rails db:create db:migrate "?

This is the error message I get:
rails aborted!
LoadError: cannot load such file -- active_record/railties/databases.rake
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:69:in `load'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:69:in `rescue in load'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:52:in `load'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `block in load'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `load'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/activerecord-5.2.3/lib/active_record/railtie.rb:49:in `block in <class:Railtie>'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/railtie.rb:246:in `instance_exec'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/railtie.rb:246:in `block in run_tasks_blocks'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/railtie.rb:255:in `each'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/railtie.rb:255:in `each_registered_block'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/railtie.rb:246:in `run_tasks_blocks'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/application.rb:514:in `block in run_tasks_blocks'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/engine/railties.rb:15:in `each'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/engine/railties.rb:15:in `each'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/application.rb:514:in `run_tasks_blocks'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/engine.rb:459:in `load_tasks'
/Users/Prodigy/code/PierceF/conqueredtime/Rakefile:6:in `<top (required)>'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `block in load'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `load'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/commands/rake/rake_command.rb:22:in `block in perform'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/command.rb:48:in `invoke'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<top (required)>'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
/Users/Prodigy/code/PierceF/conqueredtime/bin/rails:9:in `<top (required)>'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/spring-2.1.0/bin/spring:49:in `<top (required)>'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
/Users/Prodigy/.rvm/gems/ruby-2.5.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
/Users/Prodigy/code/PierceF/conqueredtime/bin/spring:15:in `require'
/Users/Prodigy/code/PierceF/conqueredtime/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Caused by:
Bootsnap::LoadPathCache::FallbackScan:
(See full trace by running task with --trace)
I also tried bundle exec rails db:create db:migrate but that still had no effect.
Since I was having this error only with this rails project and not the others, I thought maybe I'll try starting a brand new rails project and copy-paste the code/files from the older project into this new one. That fixed the issue! I guess since this is a small app I was able to get away with it.

Rails - NoMethodError: undefined method `each' for nil:NilClass on Model.find_by

This error occurs only in a rake, and not when run in rails console.
Here is the code that is crashing:
task upload_activities: :environment do
include GoogleHelper
file = 'upload/things_to_do_activities_upload_v1.csv'
content = File.read(file)
csv = CSV.parse(content, headers: true)
puts 'Parsed CSV successfully'
puts csv[0].to_hash # This works
csv.each do |row|
puts "1" # this is output
guide = ThingsToDoGuide.find_by(city_id: 4321) # crashes here
puts "2"
....
When running the rake, the console outputs everything until the line ThingsToDoGuide.find_by(city_id: 4321).
I can run the exact same line in rails console and it works fine.
The error text is:
rails aborted!
NoMethodError: undefined method `each' for nil:NilClass
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/httparty-0.15.5/lib/httparty/module_inheritable_attributes.rb:38:in `inherited'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activerecord-5.0.4/lib/active_record/associations/collection_proxy.rb:30:in `<module:Associations>'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activerecord-5.0.4/lib/active_record/associations/collection_proxy.rb:2:in `<module:ActiveRecord>'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activerecord-5.0.4/lib/active_record/associations/collection_proxy.rb:1:in `<top (required)>'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:293:in `require'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:293:in `block in require'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:257:in `block in load_dependency'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:662:in `new_constants_in'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:257:in `load_dependency'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:293:in `require'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/will_paginate-3.1.6/lib/will_paginate/active_record.rb:244:in `<module:ActiveRecord>'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/will_paginate-3.1.6/lib/will_paginate/active_record.rb:18:in `<module:WillPaginate>'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/will_paginate-3.1.6/lib/will_paginate/active_record.rb:6:in `<top (required)>'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:293:in `require'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:293:in `block in require'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:257:in `block in load_dependency'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:662:in `new_constants_in'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:257:in `load_dependency'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:293:in `require'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/will_paginate-3.1.6/lib/will_paginate/railtie.rb:10:in `block (2 levels) in <class:Railtie>'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/lazy_load_hooks.rb:43:in `instance_eval'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/lazy_load_hooks.rb:43:in `execute_hook'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/lazy_load_hooks.rb:50:in `block in run_load_hooks'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/lazy_load_hooks.rb:49:in `each'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/lazy_load_hooks.rb:49:in `run_load_hooks'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activerecord-5.0.4/lib/active_record/base.rb:324:in `<module:ActiveRecord>'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activerecord-5.0.4/lib/active_record/base.rb:24:in `<top (required)>'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:293:in `require'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:293:in `block in require'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:257:in `block in load_dependency'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:662:in `new_constants_in'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:257:in `load_dependency'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:293:in `require'
/Users/Calvino/dev/triphappy/app/models/application_record.rb:3:in `<top (required)>'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:477:in `load'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:477:in `block in load_file'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:662:in `new_constants_in'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:476:in `load_file'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:375:in `block in require_or_load'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:37:in `block in load_interlock'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/concurrency/share_lock.rb:150:in `exclusive'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies/interlock.rb:11:in `loading'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:37:in `load_interlock'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:358:in `require_or_load'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:511:in `load_missing_constant'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:203:in `const_missing'
/Users/Calvino/dev/triphappy/app/models/things_to_do_guide.rb:1:in `<top (required)>'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:477:in `load'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:477:in `block in load_file'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:662:in `new_constants_in'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:476:in `load_file'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:375:in `block in require_or_load'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:37:in `block in load_interlock'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/concurrency/share_lock.rb:150:in `exclusive'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies/interlock.rb:11:in `loading'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:37:in `load_interlock'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:358:in `require_or_load'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:511:in `load_missing_constant'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.4/lib/active_support/dependencies.rb:203:in `const_missing'
/Users/Calvino/dev/triphappy/lib/tasks/things_to_do.rake:81:in `block (3 levels) in <top (required)>'
/Users/Calvino/dev/triphappy/lib/tasks/things_to_do.rake:76:in `block (2 levels) in <top (required)>'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/railties-5.0.4/lib/rails/commands/rake_proxy.rb:14:in `block in run_rake_task'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/railties-5.0.4/lib/rails/commands/rake_proxy.rb:11:in `run_rake_task'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/railties-5.0.4/lib/rails/commands/commands_tasks.rb:51:in `run_command!'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/railties-5.0.4/lib/rails/commands.rb:18:in `<top (required)>'
/Users/Calvino/dev/triphappy/bin/rails:9:in `require'
/Users/Calvino/dev/triphappy/bin/rails:9:in `<top (required)>'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
/Users/Calvino/.rvm/gems/ruby-2.4.1/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
/Users/Calvino/dev/triphappy/bin/spring:15:in `require'
/Users/Calvino/dev/triphappy/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => things_to_do:upload_activities
(See full trace by running task with --trace)
I figured there is a problem with the model, but it is completely blank.
class ThingsToDoGuide < ApplicationRecord
end
Any thoughts?
This looks like an issue with the HTTParty gem, not Rails. If you go to the inherited method at line 38 of httparty/lib/module_inheritable_attributes.rb as suggested by the stack trace you'll see the each method being called on an instance variable. That instance variable must be nil in that context for some reason. You might consider opening an issue in the repo.
https://github.com/jnunemaker/httparty/blob/master/lib/httparty/module_inheritable_attributes.rb#L38

i get this errors whenever i want to generate a new controller

Aikers-MBP:app Aiker$ rails g controller index home
Running via Spring preloader in process 62820
/Users/Aiker/Desktop/app/vendor/bundle/gems/thor-0.19.2/lib/thor/parser/option.rb:130:in `validate_default_type!': An option's default must match its type. (ArgumentError)
from /Users/Aiker/Desktop/app/vendor/bundle/gems/thor-0.19.2/lib/thor/parser/option.rb:113:in `validate!'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/thor-0.19.2/lib/thor/parser/argument.rb:24:in `initialize'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/thor-0.19.2/lib/thor/parser/option.rb:9:in `initialize'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/thor-0.19.2/lib/thor/base.rb:544:in `new'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/thor-0.19.2/lib/thor/base.rb:544:in `build_option'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/thor-0.19.2/lib/thor/base.rb:278:in `class_option'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/railties-5.0.0.1/lib/rails/generators/base.rb:202:in `class_option'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/railties-5.0.0.1/lib/rails/generators/base.rb:178:in `block in hook_for'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/railties-5.0.0.1/lib/rails/generators/base.rb:168:in `each'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/railties-5.0.0.1/lib/rails/generators/base.rb:168:in `hook_for'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/jbuilder-2.6.0/lib/generators/rails/scaffold_controller_generator.rb:9:in `<class:ScaffoldControllerGenerator>'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/jbuilder-2.6.0/lib/generators/rails/scaffold_controller_generator.rb:6:in `<module:Generators>'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/jbuilder-2.6.0/lib/generators/rails/scaffold_controller_generator.rb:5:in `<module:Rails>'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/jbuilder-2.6.0/lib/generators/rails/scaffold_controller_generator.rb:4:in `<top (required)>'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/jbuilder-2.6.0/lib/jbuilder/railtie.rb:32:in `block in <class:Railtie>'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/railties-5.0.0.1/lib/rails/railtie.rb:230:in `block in run_generators_blocks'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/railties-5.0.0.1/lib/rails/railtie.rb:247:in `each'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/railties-5.0.0.1/lib/rails/railtie.rb:247:in `each_registered_block'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/railties-5.0.0.1/lib/rails/railtie.rb:230:in `run_generators_blocks'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/railties-5.0.0.1/lib/rails/application.rb:453:in `block in run_generators_blocks'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/railties-5.0.0.1/lib/rails/engine/railties.rb:13:in `each'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/railties-5.0.0.1/lib/rails/engine/railties.rb:13:in `each'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/railties-5.0.0.1/lib/rails/application.rb:453:in `run_generators_blocks'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/railties-5.0.0.1/lib/rails/engine.rb:465:in `load_generators'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:144:in `generate_or_destroy'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:60:in `generate'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /Users/Aiker/Desktop/app/bin/rails:9:in `<top (required)>'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `block in load'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/Aiker/Desktop/app/vendor/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
from /Users/Aiker/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/Aiker/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
Aikers-MBP:app Aiker$

Is there something wrong with this Rails Console error message?

Very new to Rails, so bear with me -
Currently paranoid that my ruby and gem versions aren't up to date because I'd occasionally get error messages when running rails test. Previously had rvm and rbenv both installed, but wow I've removed both and reinstalled rvm only.
When I go into a irb and call an action that doesn't work, such as: "foo".select, I get a simple error message:
NoMethodError: private method 'select' called for "foo":String
from (irb):4
from /Users/Joseph/.rvm/rubies/ruby-2.3.1/bin/irb:11:in '<main>'
However, when I type the same command "foo".select in rails console instead, I get:
NoMethodError: private method `select' called for "foo":String
from (irb):1
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/railties-5.0.0.1/lib/rails/commands/console.rb:65:in `start'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/railties-5.0.0.1/lib/rails/commands/console_helper.rb:9:in `start'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:78:in `console'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /Users/Joseph/workspace/sample_app/bin/rails:9:in `<top (required)>'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `block in load'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/commands/rails.rb:6:in `call'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/command_wrapper.rb:38:in `call'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:191:in `block in serve'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:161:in `fork'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:161:in `serve'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:131:in `block in run'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:125:in `loop'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:125:in `run'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from /Users/Joseph/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/Joseph/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
Is this normal? Or is there something wrong with my gems here?
There's nothing wrong with your gems. The thing is that when you run irb, it's just that. You only run the ruby interactive.
When you run rails console in order to show you the console it needs to go and set it for you with ActiveRecord, rails core, etc. So this (below) is all it does before it's set.
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/railties-5.0.0.1/lib/rails/commands/console.rb:65:in `start'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/railties-5.0.0.1/lib/rails/commands/console_helper.rb:9:in `start'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:78:in `console'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /Users/Joseph/workspace/sample_app/bin/rails:9:in `<top (required)>'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `block in load'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/commands/rails.rb:6:in `call'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/command_wrapper.rb:38:in `call'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:191:in `block in serve'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:161:in `fork'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:161:in `serve'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:131:in `block in run'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:125:in `loop'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application.rb:125:in `run'
from /Users/Joseph/.rvm/gems/ruby-2.3.1#sample_app/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from /Users/Joseph/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/Joseph/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
Notice that irb is executed really fast, while rails console takes its time, depending on your initializers, configurations, etc.

Rails s command returns syntax error

My Rails s command is not working, below is what I get. Line 7, where the syntax error is: require 'psych/parser'. Not sure how to correct this error.
/home/vagrant/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/psych.rb:205:in `parse': (<unknown>): found character that cannot start any token while scanning for the next token at line 7 column 1 (Psych::SyntaxError)
from /home/vagrant/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/psych.rb:205:in `parse_stream'
from /home/vagrant/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/psych.rb:153:in `parse'
from /home/vagrant/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/psych.rb:129:in `load'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/figaro-0.7.0/lib/figaro.rb:21:in `raw'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/figaro-0.7.0/lib/figaro.rb:17:in `env'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/figaro-0.7.0/lib/figaro/railtie.rb:7:in `block in <class:Railtie>'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.1.5/lib/active_support/lazy_load_hooks.rb:36:in `call'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.1.5/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.1.5/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.1.5/lib/active_support/lazy_load_hooks.rb:44:in `each'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/activesupport-4.1.5/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.5/lib/rails/application.rb:123:in `initialize'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.5/lib/rails/railtie.rb:171:in `new'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.5/lib/rails/railtie.rb:171:in `instance'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.5/lib/rails/application.rb:90:in `inherited'
from /home/vagrant/code/bloccit/config/application.rb:17:in `<module:Bloccit>'
from /home/vagrant/code/bloccit/config/application.rb:16:in `<top (required)>'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:79:in `require'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:79:in `block in server'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:76:in `tap'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:76:in `server'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/railties-4.1.5/lib/rails/commands.rb:17:in `<top (required)>'
from /home/vagrant/code/bloccit/bin/rails:8:in `require'
from /home/vagrant/code/bloccit/bin/rails:8:in `<top (required)>'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `load'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `call'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/spring-1.1.3/lib/spring/client.rb:26:in `run'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/spring-1.1.3/bin/spring:48:in `<top (required)>'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `load'
from /home/vagrant/.rvm/gems/ruby-2.0.0-p481/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `<top (required)>'
from /home/vagrant/code/bloccit/bin/spring:16:in `require'
from /home/vagrant/code/bloccit/bin/spring:16:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'

Resources