rails console not working due to no remaing live threads - ruby-on-rails

I made a ActiveJob class for a background work collecting some data from the server and storing the data to my DB.
To make the job working, I added some trigger code as
# in config/environment.rb
MyJob.perform_later
# the perform method
def perform(*args)
update_db
MyJob.set(wait: 1.minutes).perform_later
end
But, after that suddenly, bin/rails console stoped working.
My rails version is '7.0.4' and ruby version is '3.1.2'
The error log is following:
$ ./bin/rails console
.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/activerecord-7.0.4/lib/active_record/base.rb:282:in `<module:ActiveRecord>': No live threads left. Deadlock? (fatal)
3 threads, 3 sleeps current:0x000000010b0e22b0 main thread:0x0000000139e04610
* #<Thread:0x0000000100fa4d48 sleep_forever>
rb_thread_t:0x0000000139e04610 native:0x000000010103c580 int:0
* #<Thread:0x0000000106403e48#DEBUGGER__::SESSION#server .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/debug-1.6.2/lib/debug/session.rb:154 sleep_forever>
rb_thread_t:0x000000010a6b9190 native:0x000000016f1b7000 int:0
* #<Thread:0x00000001065f1b60#worker-1 .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/concurrent-ruby-1.1.10/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:332 sleep_forever>
rb_thread_t:0x000000010b0e22b0 native:0x000000016f3c3000 int:0
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/activerecord-7.0.4/lib/active_record/base.rb:15:in `<main>'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/zeitwerk-2.6.1/lib/zeitwerk/kernel.rb:35:in `require'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/activerecord-7.0.4/lib/active_record/railtie.rb:62:in `block in <class:Railtie>'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/railtie.rb:273:in `block in run_console_blocks'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/railtie.rb:298:in `each'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/railtie.rb:298:in `each_registered_block'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/railtie.rb:273:in `run_console_blocks'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/application.rb:526:in `block in run_console_blocks'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/engine/railties.rb:15:in `each'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/engine/railties.rb:15:in `each'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/application.rb:526:in `run_console_blocks'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/engine.rb:449:in `load_console'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/console/console_command.rb:35:in `initialize'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/console/console_command.rb:19:in `new'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/console/console_command.rb:19:in `start'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/console/console_command.rb:102:in `perform'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/command/base.rb:87:in `perform'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/command.rb:48:in `invoke'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands.rb:18:in `<main>'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from .asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
from ./bin/rails:4:in `<main>'
I have searched any way to solve this problem but, I couldn't.
I just guess this problem is about the thread of ActiveJob or updating ActiveRecord(DB).
Please give me some help.
Thanks in advance!

The problem is caused by "MyJob.perform_later" in the "environment.rb" file. After I move the line to "config.after_initialize" block in "config/application.rb" file, I can use the console.

Related

Rails - Ruby 3.1.1 will not load on CentOS but okay on OSX

I have a rails app that runs fine on my development iMac (Ventura). I pushed to production CentOS7. It bundled up fine but when trying to to assets precompile I get the error below. I have tried, removing lock file and re-bundling, updating bundler, did gem update and did yum update on server. I get the following when doing rake assets:clean precompile and I see similar error in apache log as well. I am running rails 7.0.4.2 and ruby 3.1.1. I need some guidance on how to resolve.
rake assets:clean precompile
rake aborted!
LoadError: cannot load such file -- Version
<internal:/usr/local/rvm/rubies/ruby-3.1.1/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
<internal:/usr/local/rvm/rubies/ruby-3.1.1/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
/usr/local/rvm/gems/ruby-3.1.1/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
/admin/bin/rails/catering_bk/config/initializers/active_admin.rb:290:in `block in <top (required)>'
/usr/local/rvm/gems/ruby-3.1.1/gems/activeadmin-2.13.1/lib/active_admin.rb:68:in `setup'
/admin/bin/rails/catering_bk/config/initializers/active_admin.rb:1:in `<top (required)>'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:667:in `load'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:667:in `block in load_config_initializer'
/usr/local/rvm/gems/ruby-3.1.1/gems/activesupport-7.0.4.2/lib/active_support/notifications.rb:208:in `instrument'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:666:in `load_config_initializer'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:620:in `block (2 levels) in <class:Engine>'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:619:in `each'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/engine.rb:619:in `block in <class:Engine>'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:32:in `instance_exec'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:32:in `run'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:61:in `block in run_initializers'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:50:in `each'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:50:in `tsort_each_child'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/initializable.rb:60:in `run_initializers'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/application.rb:372:in `initialize!'
/admin/bin/rails/catering_bk/config/environment.rb:5:in `<top (required)>'
<internal:/usr/local/rvm/rubies/ruby-3.1.1/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
<internal:/usr/local/rvm/rubies/ruby-3.1.1/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
/usr/local/rvm/gems/ruby-3.1.1/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/application.rb:348:in `require_environment!'
/usr/local/rvm/gems/ruby-3.1.1/gems/railties-7.0.4.2/lib/rails/application.rb:511:in `block in run_tasks_blocks'
/usr/local/rvm/gems/ruby-3.1.1/gems/sprockets-rails-3.4.2/lib/sprockets/rails/task.rb:61:in `block (2 levels) in define'
/usr/local/rvm/gems/ruby-3.1.1/bin/ruby_executable_hooks:22:in `eval'
/usr/local/rvm/gems/ruby-3.1.1/bin/ruby_executable_hooks:22:in `<main>'
Tasks: TOP => environment
(See full trace by running task with --trace)
As noted above. I tried
Remove lock file and bundle again.
gem update
yum update
Also to note this is also an older app that was upgraded to be in compliance with Veracode. It works perfectly on OSX, so the issue must be within CentOS.

`auth_data=': couldn't set additional authenticated data

I am new on RoR and created a new project with all configurations of ruby and rails.
I have
mac version 12.4 Monterey
rails 6.0.5
ruby 2.7.2
postgresql
I configured these using rbnev from this tutorial https://gorails.com/setup/osx/12-monterey and https://collectionbuilder.github.io/cb-docs/docs/software/ruby_mac/
I created new app using rails new myapp -d postgresql. It's showing this error while building the project:
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.0.5/lib/active_support/message_encryptor.rb:173:in `auth_data=': couldn't set additional authenticated data (OpenSSL::Cipher::CipherError)
from /Library/Ruby/Gems/2.6.0/gems/activesupport-6.0.5/lib/active_support/message_encryptor.rb:173:in `_encrypt'
from /Library/Ruby/Gems/2.6.0/gems/activesupport-6.0.5/lib/active_support/message_encryptor.rb:151:in `encrypt_and_sign'
from /Library/Ruby/Gems/2.6.0/gems/activesupport-6.0.5/lib/active_support/encrypted_file.rb:76:in `encrypt'
from /Library/Ruby/Gems/2.6.0/gems/activesupport-6.0.5/lib/active_support/encrypted_file.rb:50:in `write'
from /Library/Ruby/Gems/2.6.0/gems/activesupport-6.0.5/lib/active_support/encrypted_configuration.rb:29:in `write'
from /Library/Ruby/Gems/2.6.0/gems/railties-6.0.5/lib/rails/generators/rails/credentials/credentials_generator.rb:30:in `add_credentials_file_silently'
from /Library/Ruby/Gems/2.6.0/gems/railties-6.0.5/lib/rails/generators/rails/app/app_generator.rb:177:in `credentials'
from /Library/Ruby/Gems/2.6.0/gems/railties-6.0.5/lib/rails/generators/app_base.rb:155:in `build'
from /Library/Ruby/Gems/2.6.0/gems/railties-6.0.5/lib/rails/generators/rails/app/app_generator.rb:332:in `create_credentials'
from /Library/Ruby/Gems/2.6.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
from /Library/Ruby/Gems/2.6.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
from /Library/Ruby/Gems/2.6.0/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `block in invoke_all'
from /Library/Ruby/Gems/2.6.0/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `each'
from /Library/Ruby/Gems/2.6.0/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `map'
from /Library/Ruby/Gems/2.6.0/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `invoke_all'
from /Library/Ruby/Gems/2.6.0/gems/thor-1.2.1/lib/thor/group.rb:232:in `dispatch'
from /Library/Ruby/Gems/2.6.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
from /Library/Ruby/Gems/2.6.0/gems/railties-6.0.5/lib/rails/commands/application/application_command.rb:26:in `perform'
from /Library/Ruby/Gems/2.6.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
from /Library/Ruby/Gems/2.6.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
from /Library/Ruby/Gems/2.6.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
from /Library/Ruby/Gems/2.6.0/gems/railties-6.0.5/lib/rails/command/base.rb:69:in `perform'
from /Library/Ruby/Gems/2.6.0/gems/railties-6.0.5/lib/rails/command.rb:46:in `invoke'
from /Library/Ruby/Gems/2.6.0/gems/railties-6.0.5/lib/rails/cli.rb:18:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:65:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:65:in `require'
from /Library/Ruby/Gems/2.6.0/gems/railties-6.0.5/exe/rails:10:in `<top (required)>'
from /usr/bin/rails:22:in `load'
from /usr/bin/rails:22:in `<main>'
According to your issues on MAC device for ROR, You might be facing the issues because of versioning system and rbnev, and I got an article over the internet that described the same issue with some solutions.
Maybe this article will help you to fix that problem
If you can fix the issue from the article then let me know here too.

rails - running production mode locally = No such file to load - config/environment

I am trying to run locally in production mode with:
$ RAILS_ENV=production rails s
But I get:
/home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/li
b/active_support/dependencies.rb:306:in `rescue in depend_on': No such file
to load -- /home/durrantm/Dropnot/webs/rails_apps/linker/app/assets/../con
fig/environment (LoadError)
I can create a brand new rails 3.1.8 app and do RAILS_ENV=production rails server and I don't get this problem.
I can also do rails s and that runs the server fine in development mode without error.
I can also do RAILS_ENV=development rails s and that runs the server fine in development mode without error.
fwiw, my app was originally a rails 2.3 app so perhaps I am missing something that's been added or changed in rails ?
I do have the config directory with an environment.rb file. Perhaps the way it's being referenced is wrong somehow?
I added config.assets.enabled = true to config/application.rb but it didn't help (didn't expect it to as that is asset compilation, but it was a difference I found!).
Full Trace:
durrantm#Castle2012:~/Dropnot/webs/rails_apps/linker/config/environments (v3.1.8_with_assets)
$ RAILS_ENV=production rails s
=> Booting WEBrick
=> Rails 3.1.8 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:306:in `rescue in depend_on': No such file to load -- /home/durrantm/Dropnot/webs/rails_apps/linker/app/assets/../config/environment (LoadError)
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:301:in `depend_on'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:214:in `require_dependency'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:417:in `block (2 levels) in eager_load!'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:416:in `each'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:416:in `block in eager_load!'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:414:in `each'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/engine.rb:414:in `eager_load!'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/application/finisher.rb:51:in `block in <module:Finisher>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:30:in `instance_exec'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:30:in `run'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:54:in `each'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/initializable.rb:54:in `run_initializers'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/application.rb:96:in `initialize!'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config/environment.rb:5:in `<top (required)>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:240:in `require'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:240:in `block in require'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:223:in `load_dependency'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/activesupport-3.1.8/lib/active_support/dependencies.rb:240:in `require'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config.ru:4:in `block in <main>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/builder.rb:51:in `instance_eval'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/builder.rb:51:in `initialize'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config.ru:1:in `new'
from /home/durrantm/Dropnot/webs/rails_apps/linker/config.ru:1:in `<main>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/builder.rb:40:in `eval'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/builder.rb:40:in `parse_file'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/server.rb:200:in `app'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands/server.rb:46:in `app'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/server.rb:301:in `wrapped_app'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/rack-1.3.6/lib/rack/server.rb:252:in `start'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands/server.rb:70:in `start'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands.rb:54:in `block in <top (required)>'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands.rb:49:in `tap'
from /home/durrantm/.rvm/gems/ruby-1.9.3-p194#linker/gems/railties-3.1.8/lib/rails/commands.rb:49:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Changed a few things. One of the main ones were to enable static assets locally in config/environments/production.rb when trying to run it locally (only) and revert that before pushing to a production web server. I didn't know that.
seems like your old assets directory lived in other place (maybe in public) and now it is in app/assets, but it doesn't know about it and some files try to load environment.rb. just double check assets dir.

NoMethodError on Rails Vulcanize with Rubber

I am very new to rails and am trying to get my app setup via rubber. I was able to get a test app up without issue but am running into some sort of error when actually trying to vulcanize my built app. Tried to search high and low to no avail. Anyone have any idea what I need to do to get rid of the issue? Much appreciated.
localhost:thiswins markhayden$ rubber vulcanize complete_passenger_nginx_mysql
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/rubber-2.2.4/lib/rubber/commands/vulcanize.rb:53:in `block in <class:Vulcanize>': undefined method `-' for "complete_passenger_nginx_mysql":String (NoMethodError)
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/attribute/declaration.rb:33:in `instance_exec'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/attribute/declaration.rb:33:in `block in define_writer_for'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/parameter/parsing.rb:13:in `block (2 levels) in parse_parameters'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/parameter/parsing.rb:12:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/parameter/parsing.rb:12:in `block in parse_parameters'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/parameter/parsing.rb:10:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/parameter/parsing.rb:10:in `parse_parameters'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/command.rb:55:in `parse'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/command.rb:68:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/subcommand/execution.rb:11:in `execute'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/command.rb:69:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/clamp-0.6.0/lib/clamp/command.rb:127:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rubber-2.2.4/bin/rubber:17:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p392/bin/rubber:19:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p392/bin/rubber:19:in `<main>'
from /usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `eval'
from /usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:14:in `<main>'
We had this same problem with:
rubber vulcanize complete_passenger_postgresql
It seems to be an error in the gem at rubber/commands/vulcanize.rb on Line 53 because it tries to subtract an array from a string which is illegal. I changed it to (as sudo):
invalid = (arg.kind_of?(String) ? [arg] : arg) - VulcanizeThor.valid_templates
This allowed setup however I am not sure if the vulcanization did more than it was supposed to have because I am also new to Rubber. This was a drastic measure so be careful by trying it on a non-production environment first!

rails generate mailer psych.rb parse bug

I am new to ruby and rails and was working to setup my first mailer, and when I run the generate command my setup is blowing up. I am currently running ruby-1.9.3-p374 and have been searching for awhile now for a fix for this. My other generate commands work fine, just this one seems to be borked. Thoughts?
rails generate mailer UserMailer
/Users/chrishough/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/psych.rb:203:in `parse': (<unknown>): mapping values are not allowed in this context at line 4 column 12 (Psych::SyntaxError)
from /Users/chrishough/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/psych.rb:203:in `parse_stream'
from /Users/chrishough/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/psych.rb:151:in `parse'
from /Users/chrishough/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/psych.rb:127:in `load'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374#My-Application-Profiles/gems/figaro-0.6.3/lib/figaro.rb:21:in `raw'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374#My-Application-Profiles/gems/figaro-0.6.3/lib/figaro.rb:17:in `env'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374#My-Application-Profiles/gems/figaro-0.6.3/lib/figaro/railtie.rb:7:in `block in <class:Railtie>'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374#My-Application-Profiles/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:34:in `call'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374#My-Application-Profiles/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:34:in `execute_hook'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374#My-Application-Profiles/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374#My-Application-Profiles/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:42:in `each'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374#My-Application-Profiles/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374#My-Application-Profiles/gems/railties-3.2.13/lib/rails/application.rb:67:in `inherited'
from /Users/chrishough/Huedio/Code/Profiles/config/application.rb:27:in `<module:Profiles>'
from /Users/chrishough/Huedio/Code/Profiles/config/application.rb:26:in `<top (required)>'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374#My-Application-Profiles/gems/railties-3.2.13/lib/rails/commands.rb:24:in `require'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374#My-Application-Profiles/gems/railties-3.2.13/lib/rails/commands.rb:24:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
If you are using the figaro gem and your generators start blowing up, here is what killed me. In my application.yml file I had removed a space between the environment variable name and what it was set to. Instead of this =>> MY_VARIABLE:"VARIABLE" I needed to have this ==> MY_VARIABLE: "VARIABLE"
Hopefully this will save others TIME!

Resources