Rails wrong number of arguments error when generating migration - ruby-on-rails

I am trying to run bin/rails generate migration ClientsUsersXrefTable
And I get this error:
/Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activerecord-5.2.6/lib/active_record/
persistence.rb:138:in `destroy': wrong number of arguments (given 0, expected 1) (ArgumentError)
I am on ruby 2.7.3p183 and rails 5.2.6. What am I missing? Here is the full trace.
Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/. To suppress this message, set the GOOGLE_AUTH_SUPPRESS_CREDENTIALS_WARNINGS environment variable.
Note: Google::Cloud::Logging is disabled because the project ID could not be determined. Falling back to the default Rails logger.
DEPRECATION WARNING: Sprockets method `register_engine` is deprecated.
Please register a mime type using `register_mime_type` then
use `register_compressor` or `register_transformer`.
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
(called from block in <class:Railtie> at /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/less-rails-2.8.0/lib/less/rails/railtie.rb:16)
DEPRECATION WARNING: You are using a deprecated processor interface Less::Rails::ImportProcessor.
Please update your processor interface:
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
(called from block in <class:Railtie> at /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/less-rails-2.8.0/lib/less/rails/railtie.rb:21)
Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/. To suppress this message, set the GOOGLE_AUTH_SUPPRESS_CREDENTIALS_WARNINGS environment variable.
Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/. To suppress this message, set the GOOGLE_AUTH_SUPPRESS_CREDENTIALS_WARNINGS environment variable.
Note: Google::Cloud::ErrorReporting is disabled because the project ID could not be determined.
Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/. To suppress this message, set the GOOGLE_AUTH_SUPPRESS_CREDENTIALS_WARNINGS environment variable.
Your application has authenticated using end user credentials from Google Cloud SDK. We recommend that most server applications use service accounts instead. If your application continues to use end user credentials from Cloud SDK, you might receive a "quota exceeded" or "API not enabled" error. For more information about service accounts, see https://cloud.google.com/docs/authentication/. To suppress this message, set the GOOGLE_AUTH_SUPPRESS_CREDENTIALS_WARNINGS environment variable.
Note: Google::Cloud::Trace is disabled because the project ID could not be determined.
/Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activerecord-5.2.6/lib/active_record/persistence.rb:138:in `destroy': wrong number of arguments (given 0, expected 1) (ArgumentError)
from /Users/user/projects/big-rain/app/models/user.rb:8:in `<class:User>'
from /Users/user/projects/big-rain/app/models/user.rb:3:in `<main>'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:476:in `block in load_file'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:661:in `new_constants_in'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:475:in `load_file'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:373:in `block in require_or_load'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:37:in `block in load_interlock'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/dependencies/interlock.rb:14:in `block in loading'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/dependencies/interlock.rb:13:in `loading'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:37:in `load_interlock'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:356:in `require_or_load'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:510:in `load_missing_constant'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:195:in `const_missing'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/inflector/methods.rb:283:in `const_get'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/inflector/methods.rb:283:in `block in constantize'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/inflector/methods.rb:281:in `each'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/inflector/methods.rb:281:in `inject'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/inflector/methods.rb:281:in `constantize'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:582:in `get'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:613:in `constantize'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/devise-4.8.0/lib/devise.rb:316:in `get'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/devise-4.8.0/lib/devise/mapping.rb:83:in `to'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/devise-4.8.0/lib/devise/mapping.rb:78:in `modules'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/devise-4.8.0/lib/devise/mapping.rb:95:in `routes'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/devise-4.8.0/lib/devise/mapping.rb:162:in `default_used_route'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/devise-4.8.0/lib/devise/mapping.rb:72:in `initialize'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/devise-4.8.0/lib/devise.rb:346:in `new'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/devise-4.8.0/lib/devise.rb:346:in `add_mapping'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/devise-4.8.0/lib/devise/rails/routes.rb:243:in `block in devise_for'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/devise-4.8.0/lib/devise/rails/routes.rb:242:in `each'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/devise-4.8.0/lib/devise/rails/routes.rb:242:in `devise_for'
from /Users/user/projects/big-rain/config/routes.rb:4:in `block in <main>'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/actionpack-5.2.6/lib/action_dispatch/routing/route_set.rb:432:in `instance_exec'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/actionpack-5.2.6/lib/action_dispatch/routing/route_set.rb:432:in `eval_block'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/actionpack-5.2.6/lib/action_dispatch/routing/route_set.rb:414:in `draw'
from /Users/user/projects/big-rain/config/routes.rb:1:in `<main>'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:285:in `block in load'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:257:in `load_dependency'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:285:in `load'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/railties-5.2.6/lib/rails/application/routes_reloader.rb:41:in `block in load_paths'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/railties-5.2.6/lib/rails/application/routes_reloader.rb:41:in `each'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/railties-5.2.6/lib/rails/application/routes_reloader.rb:41:in `load_paths'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/railties-5.2.6/lib/rails/application/routes_reloader.rb:20:in `reload!'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/railties-5.2.6/lib/rails/application/routes_reloader.rb:30:in `block in updater'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/file_update_checker.rb:83:in `execute'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/railties-5.2.6/lib/rails/application/routes_reloader.rb:10:in `execute'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/railties-5.2.6/lib/rails/application/finisher.rb:130:in `block in <module:Finisher>'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/railties-5.2.6/lib/rails/initializable.rb:32:in `instance_exec'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/railties-5.2.6/lib/rails/initializable.rb:32:in `run'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/railties-5.2.6/lib/rails/initializable.rb:61:in `block in run_initializers'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/2.7.0/tsort.rb:228:in `block in tsort_each'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/2.7.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/2.7.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/2.7.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/2.7.0/tsort.rb:347:in `each'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/2.7.0/tsort.rb:347:in `call'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/2.7.0/tsort.rb:347:in `each_strongly_connected_component'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/2.7.0/tsort.rb:226:in `tsort_each'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/2.7.0/tsort.rb:205:in `tsort_each'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/railties-5.2.6/lib/rails/initializable.rb:60:in `run_initializers'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/railties-5.2.6/lib/rails/application.rb:361:in `initialize!'
from /Users/user/projects/big-rain/config/environment.rb:5:in `<main>'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/bootsnap-1.7.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:291:in `block in require'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:257:in `load_dependency'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/activesupport-5.2.6/lib/active_support/dependencies.rb:291:in `require'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:106:in `preload'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:157:in `serve'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:145:in `block in run'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:139:in `loop'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/application.rb:139:in `run'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/application/boot.rb:19:in `<top (required)>'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
from /Users/user/.rbenv/versions/2.7.3/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
from -e:1:in `<main>'

Whenever you run a Rails command, it will potentially set up a bunch of classes before doing the actual work, and unlike many other languages, in Ruby this setup is done by actual Ruby code (this is how DSLs work), and any broken code that runs during that time will prevent any commands from running.
It won't run any instance methods, but any broken class-level code will cause issues.
So the migration thing is just a red herring, presumably all your Rails commands are broken.
According to your stacktrace, app/models/user.rb:8 (which you haven't provided), is getting run during initialisation. Models getting loaded during initialisation is quite common, but in this case that code is breaking.
Looking at the ActiveRecord source code (with less -N `bundle show activerecord`/lib/active_record/persistence.rb and looking at line 138), you seem to be calling the destroy class method (e.g. User.destroy(1)) but without parameters, like you do with the destroy instance method (e.g. User.find(1).destroy). So you should make sure you understand the difference between these two.
I'm not sure why you would be calling User.destroy outside of an instance method, but not having the relevant user model code I cannot say. Is there just a stray "destroy" by itself there?

Related

YAML parsing error on unknown file of Sidekiq container

I am having trouble when i try to run this Sidekiq service on a docker container. My project is based on Ruby on Rails, and besides Sidekiq, it goes along with Mongoid, Redis, and the Rails REST API i've built.
All other services go up, but this one (actuator-controller-sidekiq) breaks with the stack below. I already checked ALL of the .yml files of the project for whitespaces, bad identation and everything else, but i can't even understand where exactly is the problem when i read this stack. Can someone help?
Im not sure which of the files from my project are relevant to put here, so if you guys could comment them, i will be editing the question with the requested files.
(<unknown>): did not find expected key while parsing a block mapping at line 8 column 11
/usr/lib/ruby/2.5.0/psych.rb:402:in `parse'
/usr/lib/ruby/2.5.0/psych.rb:402:in `parse_stream'
/usr/lib/ruby/2.5.0/psych.rb:350:in `parse'
/usr/lib/ruby/2.5.0/psych.rb:263:in `load'
/var/lib/gems/2.5.0/gems/mongoid-6.1.1/lib/mongoid/config/environment.rb:40:in `load_yaml'
/var/lib/gems/2.5.0/gems/mongoid-6.1.1/lib/mongoid/config.rb:86:in `load!'
/var/lib/gems/2.5.0/gems/mongoid-6.1.1/lib/mongoid.rb:104:in `load!'
/var/lib/gems/2.5.0/gems/mongoid-6.1.1/lib/mongoid/railtie.rb:59:in `block in <class:Railtie>'
/var/lib/gems/2.5.0/gems/railties-5.0.0/lib/rails/initializable.rb:30:in `instance_exec'
/var/lib/gems/2.5.0/gems/railties-5.0.0/lib/rails/initializable.rb:30:in `run'
/var/lib/gems/2.5.0/gems/railties-5.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each'
/usr/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
/usr/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from'
/usr/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component'
/usr/lib/ruby/2.5.0/tsort.rb:347:in `each'
/usr/lib/ruby/2.5.0/tsort.rb:347:in `call'
/usr/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component'
/usr/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each'
/usr/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each'
/var/lib/gems/2.5.0/gems/railties-5.0.0/lib/rails/initializable.rb:54:in `run_initializers'
/var/lib/gems/2.5.0/gems/railties-5.0.0/lib/rails/application.rb:352:in `initialize!'
/home/rafael/git/tcc/interscity-dev/actuator-controller/config/environment.rb:5:in `<top (required)>'
/var/lib/gems/2.5.0/gems/sidekiq-5.0.0/lib/sidekiq/cli.rb:255:in `require'
/var/lib/gems/2.5.0/gems/sidekiq-5.0.0/lib/sidekiq/cli.rb:255:in `boot_system'
/var/lib/gems/2.5.0/gems/sidekiq-5.0.0/lib/sidekiq/cli.rb:54:in `run'
/var/lib/gems/2.5.0/gems/sidekiq-5.0.0/bin/sidekiq:12:in `<top (required)>'
/usr/local/bin/sidekiq:23:in `load'
/usr/local/bin/sidekiq:23:in `<main>'
Just found the problem =)
The environment variables to the Mongoid host/port were not in the Sidekiq vars on the docker-compose file. Added them and now it works!

Adding custom template to mail_form gem

I'm attempting to follow the documentation for the Mail_form gem to add a custom email template. The documentation states:
To customize the e-mail template that is used create a file called contact.erb in app/views/mail_form. Take a look at lib/mail_form/views/mail_form/contact.erb in this repo to see how the default template works.
Also, I found this issue in the repo and did the same:
I created a mail_for.rb file in initializers and added MailForm::Notifier.template_root = File.join(Rails.root, "app", "views"), to the file.
I created a mail_form directory in views and added a contact.erb file and copied the default template to it.
However, when I restart the server I get the following error:
Booting WEBrick
=> Rails 4.2.5 application starting in development on http://localhost:3000
=> Run rails server -h for more startup options
=> Ctrl-C to shutdown server Exiting /Users/Tony/.rvm/gems/ruby-2.2.1/gems/actionmailer-4.2.5/lib/action_mailer/base.rb:569:in
method_missing': undefined methodtemplate_root=' for
MailForm::Notifier:Class (NoMethodError) from
/Users/Tony/Desktop/Corner_Stone/vagrant/src/cornerstone/config/initializers/mail_form.rb:1:in
<top (required)>' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:inload' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in block in load' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:240:inload_dependency' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in load' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/engine.rb:652:in
block in load_config_initializer' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/notifications.rb:166:in
instrument' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/engine.rb:651:in
load_config_initializer' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/engine.rb:616:in
block (2 levels) in <class:Engine>' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/engine.rb:615:in
each' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/engine.rb:615:in
block in <class:Engine>' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/initializable.rb:30:in
instance_exec' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/initializable.rb:30:in
run' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/initializable.rb:55:in
block in run_initializers' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:226:in
block in tsort_each' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:348:in
block (2 levels) in each_strongly_connected_component' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:420:in
block (2 levels) in each_strongly_connected_component_from' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:429:in
each_strongly_connected_component_from' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:419:in
block in each_strongly_connected_component_from' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/initializable.rb:44:in
each' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/initializable.rb:44:in
tsort_each_child' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:413:in
call' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:413:in
each_strongly_connected_component_from' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:347:in
block in each_strongly_connected_component' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in
each' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in
call' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in
each_strongly_connected_component' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:224:in
tsort_each' from
/Users/Tony/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:203:in
tsort_each' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/initializable.rb:54:in
run_initializers' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/application.rb:352:in
initialize!' from
/Users/Tony/Desktop/Corner_Stone/vagrant/src/cornerstone/config/environment.rb:5:in
' from
/Users/Tony/Desktop/Corner_Stone/vagrant/src/cornerstone/config.ru:3:in
require' from
/Users/Tony/Desktop/Corner_Stone/vagrant/src/cornerstone/config.ru:3:in
block in ' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:55:in
instance_eval' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:55:in
initialize' from
/Users/Tony/Desktop/Corner_Stone/vagrant/src/cornerstone/config.ru:in
new' from
/Users/Tony/Desktop/Corner_Stone/vagrant/src/cornerstone/config.ru:in
' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:49:in
eval' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:49:in
new_from_string' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:40:in
parse_file' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/server.rb:299:in
build_app_and_options_from_config' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/server.rb:208:in
app' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands/server.rb:61:in
app' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/server.rb:336:in
wrapped_app' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands/server.rb:139:in
log_to_stdout' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands/server.rb:78:in
start' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:80:in
block in server' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in
tap' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in
server' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in
run_command!' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands.rb:17:in
' from
/Users/Tony/Desktop/Corner_Stone/vagrant/src/cornerstone/bin/rails:9:in
require' from
/Users/Tony/Desktop/Corner_Stone/vagrant/src/cornerstone/bin/rails:9:in
' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/spring-1.6.4/lib/spring/client/rails.rb:28:in
load' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/spring-1.6.4/lib/spring/client/rails.rb:28:in
call' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/spring-1.6.4/lib/spring/client/command.rb:7:in
call' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/spring-1.6.4/lib/spring/client.rb:28:in
run' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/spring-1.6.4/bin/spring:49:in
<top (required)>' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/spring-1.6.4/lib/spring/binstub.rb:11:in
load' from
/Users/Tony/.rvm/gems/ruby-2.2.1/gems/spring-1.6.4/lib/spring/binstub.rb:11:in
<top (required)>' from
/Users/Tony/Desktop/Corner_Stone/vagrant/src/cornerstone/bin/spring:13:in
require' from
/Users/Tony/Desktop/Corner_Stone/vagrant/src/cornerstone/bin/spring:13:in
<top (required)>' from bin/rails:3:inload' from bin/rails:3:in
`'
Everything works when I remove the code in the mail_form.rb file, but I want to customize the mail notification to my liking. The error says undefined method template_root=' for MailForm::Notifier:Class, but I don't know what it means. I'm still learning so this error is a little over my head, Any help would be greatly appreciated! Thanks!
I was faced with the same problem. It was quite frustrating that their documentation is lacking information about custom template. It's so nebulous. I need to give credit to a colleague of mine for finding a quick solution. He is way more skilled than me in Ruby.
Here's what he did:
Remove/delete the mail_form.rb file in initializers. My colleague thinks the gem already does this by default, and after testing this theory I guess he was right. So you don't need the file.
Expend your External Libraries folder in your project tree and find the mail_form folder. I'm using RubyMine so I don't know if your software will show this. tell me if if it doesn't and I will update my answer and paste the initial template code.
Inside the mail_form folder, expand and access the following file lib>mail_form>views>mail_form>contact.erb. This .erb file is the initial template used by the gem.
Copy/paste the content of the file accessed above into the contact.erb file that you previously created inside your mail_form directory in your views directory. This will become your custom template.
Once this is done, you now have full control over the email template, so modify the code to your liking.

Rails console modifies keyboard input in terminal after an error is thrown

I have a bit of a strange problem.
Whenever I open up the rails console it seems to work fine until an error occurs. Then the ruby process won't stop, not even with cmd-c & cmd-z, and the keyboard gets taken over
For example, after typing in fhfh I get this returned
irb(main):003:0> fhfh
NameError: undefined local variable or method `fhfh' for main:Object
from (irb):3
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.8/lib/rails/commands/console.rb:90:in `start'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.8/lib/rails/commands/console.rb:9:in `start'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:69:in `console'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.1.8/lib/rails/commands.rb:17:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `require'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `block in require'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `require'
from /Users/tristangrace/Dropbox/repos/memoryzen/memoryzen/bin/rails:8:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in `load'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in `block in load'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in `load'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.2.0/lib/spring/commands/rails.rb:6:in `call'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.2.0/lib/spring/command_wrapper.rb:38:in `call'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.2.0/lib/spring/application.rb:183:in `block in serve'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.2.0/lib/spring/application.rb:156:in `fork'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.2.0/lib/spring/application.rb:156:in `serve'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.2.0/lib/spring/application.rb:131:in `block in run'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.2.0/lib/spring/application.rb:125:in `loop'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.2.0/lib/spring/application.rb:125:in `run'
from /Library/Ruby/Gems/2.0.0/gems/spring-1.2.0/lib/spring/application/boot.rb:18:in `<top (required)>'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1^C
Then typing anything in the terminal gets modified.
For example holding down the left arrow returns DD[D[D[D[D[[DDD
I can't even get back to using the terminal. I have to open a new one. When I try to close the window it says that a ruby process is still running, and I have to force close it.
Any ideas?
It looks like you're using OS X; what terminal program are you using?
If it's the built-in one, go to Preferences, then Profiles, choose the one that you use, click Advanced, and make sure that terminfo is xterm-256color, and that you don't have "escape non-ASCII input with Control-V" selected.
I'd also make sure "Set locale environment variables on startup" is selected.

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