Building off of this question/answer: NoMethodError - new since upgrading to Rails 4
Here is the relevant part of /models/product.rb
class Product < ActiveRecord::Base
delegate_attributes :is_master, :to => :master
has_one :master,
-> { where(["variants.is_master = ? AND variants.deleted_at IS NULL", true]) },
:class_name => 'Variant',
:autosave => true
accepts_nested_attributes_for :master, allow_destroy: false
And here is /models/variant.rb:
class Variant < ActiveRecord::Base
belongs_to :product
scope :master, -> { where(["variants.is_master = ? AND variants.deleted_at IS NULL", true]) }
Currently I get this error:
NoMethodError: undefined method `is_master=' for #<Product:0x0000000d63b980>
This didn't used to be a problem, prior to upgrading to Rails 4, because delegate_attributes should be handling it. The gem delegate_attributes is deprecated, but the methods have been moved into active_tools, which I have installed. But clearly something is still broken, so I have to work around it.
I solved a similar problem with price by:
def price=(amount)
master.price = amount
end
But when I try to do the same with is_master:
def is_master=(bool)
master.is_master = bool
end
I get the error that stack level too deep. Which I can kind of see why, if master.is_master is calling the method is_master over and over, but I wonder why this wasn't an issue with price.
This is where is_master is called, in /models/product.rb, but it's not inside Class Products.
module ProductConcerns
module Callbacks
extend ActiveSupport::Concern
included do
before_create :set_master_variant_defaults
end
def set_master_variant_defaults
self.is_master = true
end
end
end
Stack trace:
undefined method `is_master=' for #<Product:0x0000000c3bb378>
/pwd/vendor/ruby/2.1.0/gems/activemodel-4.2.10/lib/active_model/attribute_methods.rb:433:in `method_missing'
/pwd/app/models/product.rb:874:in `set_master_variant_defaults'
/pwd/vendor/ruby/2.1.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:432:in `block in make_lambda'
/pwd/vendor/ruby/2.1.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:164:in `call'
/pwd/vendor/ruby/2.1.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:164:in `block in halting'
/pwd/vendor/ruby/2.1.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:504:in `call'
/pwd/vendor/ruby/2.1.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:504:in `block in call'
/pwd/vendor/ruby/2.1.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:504:in `each'
/pwd/vendor/ruby/2.1.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:504:in `call'
/pwd/vendor/ruby/2.1.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
/pwd/vendor/ruby/2.1.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:778:in `_run_create_callbacks'
/pwd/vendor/ruby/2.1.0/gems/activerecord-4.2.10/lib/active_record/callbacks.rb:306:in `_create_record'
/pwd/vendor/ruby/2.1.0/gems/activerecord-4.2.10/lib/active_record/timestamp.rb:57:in `_create_record'
/pwd/vendor/ruby/2.1.0/gems/activerecord-4.2.10/lib/active_record/persistence.rb:504:in `create_or_update'
/pwd/vendor/ruby/2.1.0/gems/activerecord-4.2.10/lib/active_record/callbacks.rb:302:in `block in create_or_update'
/pwd/vendor/ruby/2.1.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:117:in `call'
/pwd/vendor/ruby/2.1.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:117:in `call'
/pwd/vendor/ruby/2.1.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
/pwd/vendor/ruby/2.1.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:505:in `call'
/pwd/vendor/ruby/2.1.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:505:in `call'
/pwd/vendor/ruby/2.1.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
/pwd/vendor/ruby/2.1.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:778:in `_run_save_callbacks'
/pwd/vendor/ruby/2.1.0/gems/activerecord-4.2.10/lib/active_record/callbacks.rb:302:in `create_or_update'
/pwd/vendor/ruby/2.1.0/gems/activerecord-4.2.10/lib/active_record/persistence.rb:142:in `save!'
/pwd/vendor/ruby/2.1.0/gems/activerecord-4.2.10/lib/active_record/validations.rb:43:in `save!'
/pwd/vendor/ruby/2.1.0/gems/activerecord-4.2.10/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
/pwd/vendor/ruby/2.1.0/gems/activerecord-4.2.10/lib/active_record/transactions.rb:291:in `block in save!'
/pwd/vendor/ruby/2.1.0/gems/activerecord-4.2.10/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
/pwd/vendor/ruby/2.1.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/pwd/vendor/ruby/2.1.0/gems/activerecord-4.2.10/lib/active_record/transactions.rb:220:in `transaction'
/pwd/vendor/ruby/2.1.0/gems/activerecord-4.2.10/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
/pwd/vendor/ruby/2.1.0/gems/activerecord-4.2.10/lib/active_record/transactions.rb:291:in `save!'
/pwd/vendor/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:487:in `block in save!'
/pwd/vendor/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:502:in `block (2 levels) in around_save'
/pwd/vendor/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:150:in `block in run_actions'
/pwd/vendor/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:170:in `catch_exceptions'
/pwd/vendor/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:148:in `run_actions'
/pwd/vendor/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:133:in `run_callbacks'
/pwd/vendor/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:212:in `run_callbacks'
/pwd/vendor/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:63:in `block (2 levels) in perform'
/pwd/vendor/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:63:in `catch'
/pwd/vendor/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:63:in `block in perform'
/pwd/vendor/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:186:in `within_transaction'
/pwd/vendor/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/transition_collection.rb:62:in `perform'
/pwd/vendor/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:502:in `block in around_save'
/pwd/vendor/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:530:in `block in transaction'
/pwd/vendor/ruby/2.1.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/pwd/vendor/ruby/2.1.0/gems/activerecord-4.2.10/lib/active_record/transactions.rb:220:in `transaction'
/pwd/vendor/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:529:in `transaction'
/pwd/vendor/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:501:in `around_save'
/pwd/vendor/ruby/2.1.0/gems/state_machine-1.2.0/lib/state_machine/integrations/active_record.rb:487:in `save!'
/pwd/vendor/ruby/2.1.0/gems/protected_attributes-1.1.4/lib/active_record/mass_assignment_security/validations.rb:17:in `create!'
/pwd/db/seeds.rb:112:in `block in create_merchant_with_listed_product'
/pwd/db/seeds.rb:110:in `times'
/pwd/db/seeds.rb:110:in `create_merchant_with_listed_product'
/pwd/db/seeds.rb:201:in `block in <top (required)>'
/pwd/vendor/ruby/2.1.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/pwd/vendor/ruby/2.1.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/pwd/vendor/ruby/2.1.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/pwd/vendor/ruby/2.1.0/gems/activerecord-4.2.10/lib/active_record/transactions.rb:220:in `transaction'
/pwd/db/seeds.rb:8:in `<top (required)>'
/pwd/vendor/ruby/2.1.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:268:in `load'
/pwd/vendor/ruby/2.1.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:268:in `block in load'
/pwd/vendor/ruby/2.1.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:240:in `load_dependency'
/pwd/vendor/ruby/2.1.0/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:268:in `load'
/pwd/vendor/ruby/2.1.0/gems/railties-4.2.10/lib/rails/engine.rb:547:in `load_seed'
/pwd/vendor/ruby/2.1.0/gems/activerecord-4.2.10/lib/active_record/tasks/database_tasks.rb:253:in `load_seed'
/pwd/vendor/ruby/2.1.0/gems/activerecord-4.2.10/lib/active_record/railties/databases.rake:173:in `block (2 levels) in <top (required)>'
/pwd/vendor/ruby/2.1.0/gems/activerecord-4.2.10/lib/active_record/railties/databases.rake:132:in `block (2 levels) in <top (required)>'
Related
Help, I don't understand this rails error.
I use the latest rails according to bundler's bundle install command.
I am using windows 7.
When I ran the command "rails g controller abc" it display error messages like this:
C:/Users/Owner/ruby_intro/graded-assignments/recipefinder/config/initializers/ne
w_framework_defaults.rb:21:in `<top (required)>': undefined method `halt_callbac
k_chains_on_return_false=' for ActiveSupport:Module (NoMethodError)
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-
4.2.8/lib/active_support/dependencies.rb:268:in `load'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-
4.2.8/lib/active_support/dependencies.rb:268:in `block in load'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-
4.2.8/lib/active_support/dependencies.rb:240:in `load_dependency'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-
4.2.8/lib/active_support/dependencies.rb:268:in `load'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.8
/lib/rails/engine.rb:652:in `block in load_config_initializer'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-
4.2.8/lib/active_support/notifications.rb:166:in `instrument'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.8
/lib/rails/engine.rb:651:in `load_config_initializer'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.8
/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.8
/lib/rails/engine.rb:615:in `each'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.8
/lib/rails/engine.rb:615:in `block in <class:Engine>'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.8
/lib/rails/initializable.rb:30:in `instance_exec'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.8
/lib/rails/initializable.rb:30:in `run'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.8
/lib/rails/initializable.rb:55:in `block in run_initializers'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/tsort.rb:228:in `block i
n tsort_each'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/tsort.rb:350:in `block (
2 levels) in each_strongly_connected_component'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/tsort.rb:422:in `block (
2 levels) in each_strongly_connected_component_from'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/tsort.rb:431:in `each_st
rongly_connected_component_from'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/tsort.rb:421:in `block i
n each_strongly_connected_component_from'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.8
/lib/rails/initializable.rb:44:in `each'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.8
/lib/rails/initializable.rb:44:in `tsort_each_child'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/tsort.rb:415:in `call'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/tsort.rb:415:in `each_st
rongly_connected_component_from'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/tsort.rb:349:in `block i
n each_strongly_connected_component'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `each'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `call'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `each_st
rongly_connected_component'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/tsort.rb:226:in `tsort_e
ach'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/tsort.rb:205:in `tsort_e
ach'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.8
/lib/rails/initializable.rb:54:in `run_initializers'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.8
/lib/rails/application.rb:352:in `initialize!'
from C:/Users/Owner/ruby_intro/graded-assignments/recipefinder/config/en
vironment.rb:5:in `<top (required)>'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.8
/lib/rails/application.rb:328:in `require'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.8
/lib/rails/application.rb:328:in `require_environment!'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.8
/lib/rails/commands/commands_tasks.rb:142:in `require_application_and_environmen
t!'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.8
/lib/rails/commands/commands_tasks.rb:128:in `generate_or_destroy'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.8
/lib/rails/commands/commands_tasks.rb:50:in `generate'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.8
/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.8
/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Can anybody help?
Thank you and forgive me for the broken English.
I have a Rails project that, every now and then, throws this exception in production, in a non-reproducible manner. Everything works well in development and test, and apparently in production too, but ExceptionNotifier every few weeks emails me with this exception...
I have no idea what is going on, so I'm going to dump as much information about my environment as I think is relevant, in the hopes that some of this will help troubleshoot it.
Ruby 2.1.5
Rails 4.2.1
Running in Heroku, with regular Ruby Interpreter (ie. not JRuby)
The full error is:
"Circular dependency detected while autoloading constant DeferredUpdatesHelper"
DeferredUpdatesHelper is a module defined in lib/deferred_updates_helper.rb, as such:
module DeferredUpdatesHelper
def self.something_something(params)
end
end
I can't think of any dependencies this module has. It's very simple, and as far as I can tell, all it needs is a global variable called $RedisPool, so not sure how there can be a circular dependency...
This module is used from one of my models: models/user.rb
class User < ActiveRecord::Base
def self.process_deferred_something
DeferredUpdatesHelper.something_something(params) do
# do stuff
end
end
end
That method is called from an ActiveJob:
class SomeJob < ActiveJob::Base
queue_as :default
def perform
User.process_deferred_something
end
end
Which is executed inside a Sidekiq process, and it runs perfectly happily every 10 minutes, except that every now and then I get one of these...
There are no require statement anywhere, or at least in any of these mentioned files... And as mentioned, in dev everything just works.
Stack Trace:
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:492:in `load_missing_constant'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:184:in `const_missing'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:526:in `load_missing_constant'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:184:in `const_missing'
/app/app/models/user.rb:93:in `process_deferred_something'
/app/app/jobs/some_job.rb:5:in `perform'
/app/vendor/bundle/ruby/2.1.0/gems/activejob-4.2.1/lib/active_job/execution.rb:32:in `block in perform_now'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:117:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:117:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:343:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:343:in `block (2 levels) in simple'
/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/active_job.rb:46:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/active_job.rb:46:in `perform'
/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/active_job.rb:20:in `block (3 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:441:in `instance_exec'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:441:in `block in make_lambda'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:342:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:342:in `block in simple'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:497:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:497:in `block in around'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:498:in `block (2 levels) in around'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:343:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:343:in `block (2 levels) in simple'
/app/vendor/bundle/ruby/2.1.0/gems/activejob-4.2.1/lib/active_job/logging.rb:23:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activejob-4.2.1/lib/active_job/logging.rb:23:in `block (4 levels) in <module:Logging>'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `block in instrument'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `instrument'
/app/vendor/bundle/ruby/2.1.0/gems/activejob-4.2.1/lib/active_job/logging.rb:22:in `block (3 levels) in <module:Logging>'
/app/vendor/bundle/ruby/2.1.0/gems/activejob-4.2.1/lib/active_job/logging.rb:43:in `block in tag_logger'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/tagged_logging.rb:68:in `block in tagged'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/tagged_logging.rb:26:in `tagged'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/tagged_logging.rb:68:in `tagged'
/app/vendor/bundle/ruby/2.1.0/gems/activejob-4.2.1/lib/active_job/logging.rb:43:in `tag_logger'
/app/vendor/bundle/ruby/2.1.0/gems/activejob-4.2.1/lib/active_job/logging.rb:19:in `block (2 levels) in <module:Logging>'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:441:in `instance_exec'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:441:in `block in make_lambda'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:342:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:342:in `block in simple'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:497:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:497:in `block in around'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:92:in `_run_callbacks'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:776:in `_run_perform_callbacks'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
/app/vendor/bundle/ruby/2.1.0/gems/activejob-4.2.1/lib/active_job/execution.rb:31:in `perform_now'
/app/vendor/bundle/ruby/2.1.0/gems/activejob-4.2.1/lib/active_job/execution.rb:21:in `execute'
/app/vendor/bundle/ruby/2.1.0/gems/activejob-4.2.1/lib/active_job/queue_adapters/sidekiq_adapter.rb:40:in `perform'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/processor.rb:75:in `execute_job'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/processor.rb:52:in `block (2 levels) in process'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/chain.rb:127:in `block in invoke'
/app/lib/sidekiq_monitoring.rb:46:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/sidekiq.rb:33:in `block in call'
/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:353:in `perform_action_with_newrelic_trace'
/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.11.2.286/lib/new_relic/agent/instrumentation/sidekiq.rb:29:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/server/active_record.rb:6:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/server/retry_jobs.rb:74:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/server/logging.rb:11:in `block in call'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/logging.rb:24:in `with_context'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/server/logging.rb:7:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/chain.rb:132:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/middleware/chain.rb:132:in `invoke'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/processor.rb:51:in `block in process'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/processor.rb:98:in `stats'
/app/vendor/bundle/ruby/2.1.0/gems/sidekiq-3.3.3/lib/sidekiq/processor.rb:50:in `process'
/app/vendor/bundle/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:26:in `public_send'
/app/vendor/bundle/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:26:in `dispatch'
/app/vendor/bundle/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:122:in `dispatch'
/app/vendor/bundle/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/cell.rb:60:in `block in invoke'
/app/vendor/bundle/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/cell.rb:71:in `block in task'
/app/vendor/bundle/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/actor.rb:357:in `block in task'
/app/vendor/bundle/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/tasks.rb:57:in `block in initialize'
/app/vendor/bundle/ruby/2.1.0/gems/celluloid-0.16.0/lib/celluloid/tasks/task_fiber.rb:15:in `block in create'
Any idea what could be going on, or how I can fix it?
The circular dependency error sounds possibly like a multi-threading issue to me.
You could try adding lib to eager_load_paths like so:
config.eager_load_paths += ["#{config.root}/lib"]
While apps in production environments are eager loaded by default with config.eager_load!, lib is not an included path by. You can check what is included your eager_load_paths by running Rails.configuration.eager_load_paths in the console.
Not sure if this solves your issue but it's the only thing that came to my mind. Also if you have managed to solve your issue by now I'd love to hear an update on the solution.
I am working with rails4 monogid and sidekiq , I am unable to start(exec) sidekiq with the following command
bundle exec sidekiq
following is the stack trace
wrong number of arguments (0 for 1)
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/actionview-4.1.4/lib/action_view/helpers/debug_helper.rb:29:in `debug'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/sprockets-rails-2.2.2/lib/sprockets/railtie.rb:114:in `block (2 levels) in <class:Railtie>'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:27:in `each'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/sprockets-rails-2.2.2/lib/sprockets/railtie.rb:110:in `block in <class:Railtie>'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:36:in `call'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:44:in `each'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/railties-4.1.4/lib/rails/application/finisher.rb:64:in `block in <module:Finisher>'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/railties-4.1.4/lib/rails/initializable.rb:30:in `instance_exec'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/railties-4.1.4/lib/rails/initializable.rb:30:in `run'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/railties-4.1.4/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/ratna/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
/home/ratna/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
/home/ratna/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
/home/ratna/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
/home/ratna/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `each'
/home/ratna/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `call'
/home/ratna/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
/home/ratna/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
/home/ratna/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/railties-4.1.4/lib/rails/initializable.rb:54:in `run_initializers'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/railties-4.1.4/lib/rails/application.rb:300:in `initialize!'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/railties-4.1.4/lib/rails/railtie.rb:194:in `public_send'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/railties-4.1.4/lib/rails/railtie.rb:194:in `method_missing'
/home/ratna/ratna/Projects/Vrcommand/Dec/dec10/vrcommand/config/environment.rb:6:in `<top (required)>'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `require'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `block in require'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in `load_dependency'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in `require'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/sidekiq-3.3.0/lib/sidekiq/cli.rb:236:in `boot_system'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/sidekiq-3.3.0/lib/sidekiq/cli.rb:50:in `run'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/gems/sidekiq-3.3.0/bin/sidekiq:8:in `<top (required)>'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/bin/sidekiq:23:in `load'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/bin/sidekiq:23:in `<main>'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/bin/ruby_executable_hooks:15:in `eval'
/home/ratna/.rvm/gems/ruby-2.1.5#vrcommand/bin/ruby_executable_hooks:15:in `<main>'
I am not sure why I am getting this error , can anyone please help me .
Thanks in advance
I fixed it by downgrading the sidekiq version to 3.1.x , I am getting issues with 3.2.x
I have two Models: Teacher and Department related by has_and_belongs_to_many.
When I try to save or update_attributes from the Teacher I get this error:
NoMethodError: undefined method 'destroyed?' for #<Array:0x007ff2af0204f0>
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activerecord 4.0.2/lib/active_record/autosave_association.rb:380:in 'save_has_one_association'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activerecord-4.0.2/lib/active_record/autosave_association.rb:188:in 'block in add_autosave_association_callbacks'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:383:in '_run__2528643575803035636__update__callbacks'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:80:in 'run_callbacks'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activerecord-4.0.2/lib/active_record/callbacks.rb:310:in `update_record'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activerecord-4.0.2/lib/active_record/timestamp.rb:70:in `update_record'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activerecord-4.0.2/lib/active_record/persistence.rb:477:in `create_or_update'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activerecord-4.0.2/lib/active_record/callbacks.rb:302:in `block in create_or_update'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:403:in `_run__2528643575803035636__save__callbacks'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:80:in `run_callbacks'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activerecord-4.0.2/lib/active_record/callbacks.rb:302:in `create_or_update'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activerecord-4.0.2/lib/active_record/persistence.rb:106:in `save'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activerecord-4.0.2/lib/active_record/validations.rb:51:in `save'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activerecord-4.0.2/lib/active_record/attribute_methods/dirty.rb:32:in `save'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activerecord-4.0.2/lib/active_record/transactions.rb:270:in `block (2 levels) in save'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activerecord-4.0.2/lib/active_record/transactions.rb:326:in `block in with_transaction_returning_status'
... 4 levels...
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activerecord-4.0.2/lib/active_record/transactions.rb:281:in `rollback_active_record_state!'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activerecord-4.0.2/lib/active_record/transactions.rb:269:in `save'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activerecord-4.0.2/lib/active_record/persistence.rb:230:in `block in update'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activerecord-4.0.2/lib/active_record/transactions.rb:326:in `block in with_transaction_returning_status'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `block in transaction'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:210:in `within_new_transaction'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `transaction'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activerecord-4.0.2/lib/active_record/transactions.rb:209:in `transaction'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activerecord-4.0.2/lib/active_record/transactions.rb:323:in `with_transaction_returning_status'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/activerecord-4.0.2/lib/active_record/persistence.rb:228:in `update'
from (irb):45
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/railties-4.0.2/lib/rails/commands/console.rb:90:in `start'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/railties-4.0.2/lib/rails/commands/console.rb:9:in `start'
from /Users/marcelomita/.rvm/gems/ruby-2.1.3/gems/railties-4.0.2/lib/rails/commands.rb:62:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
This error is preventing me to update my Teachers.
I don't know if this information is enogh, so if not ask me what you need. Thank you for your help and looking forward any answer.
EDIT
class Teacher < ActiveRecord::Base
#"validations are here"
has_and_belongs_to_many :department
end
class Department < ActiveRecord::Base
has_and_belongs_to_many :teacher
end
I'm developing a Rails 4 app, I've setup my server to run thin and I'm trying to setup capistrano 3 for deployment. I'm developing on windows and deploying on linux.
Currently if fails on this line:
[f98408e4] Command: bundle exec thin restart -O -C config/thin/production.yml
With a very strange exception. The funny thing is that when I ssh to the server, navigate to the current release dir and execute that command manually it runs correctly. Maybe you'll see something I don't:
cap aborted!
bundle exec thin restart -O -C config/thin/production.yml stdout: Nothing written
bundle exec thin restart -O -C config/thin/production.yml stderr: Nothing written
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/command.rb:94:in `exit_status='
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/backends/netssh.rb:125:in `block (4 levels) in _execute'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:551:in `call'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:551:in `do_request'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:561:in `channel_request'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:205:in `process'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:269:in `wait'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/backends/netssh.rb:147:in `block (2 levels) in _execute'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:514:in `call'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:205:in `process'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/backends/netssh.rb:149:in `block in _execute'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/backends/netssh.rb:106:in `tap'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/backends/netssh.rb:106:in `_execute'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/backends/netssh.rb:54:in `execute'
config/deploy.rb:23:in `block (4 levels) in <top (required)>'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/backends/abstract.rb:81:in `within'
config/deploy.rb:22:in `block (3 levels) in <top (required)>'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/backends/netssh.rb:42:in `instance_exec'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/backends/netssh.rb:42:in `run'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/runners/sequential.rb:9:in `block in execute'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/runners/sequential.rb:8:in `each'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/runners/sequential.rb:8:in `execute'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/coordinator.rb:21:in `each'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/dsl.rb:8:in `on'
config/deploy.rb:21:in `block (2 levels) in <top (required)>'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `call'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `each'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
C:/Ruby200/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/capistrano-3.0.0/lib/capistrano/dsl.rb:14:in `invoke'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/capistrano-3.0.0/lib/capistrano/tasks/deploy.rake:18:in `block (2 levels) in <top (required)>'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `call'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `each'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
C:/Ruby200/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/capistrano-3.0.0/lib/capistrano/dsl.rb:14:in `invoke'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/capistrano-3.0.0/lib/capistrano/tasks/framework.rake:64:in `block (2 levels) in <top (required)>'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/capistrano-3.0.0/lib/capistrano/tasks/framework.rake:63:in `each'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/capistrano-3.0.0/lib/capistrano/tasks/framework.rake:63:in `block in <top (required)>'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `call'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `each'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
C:/Ruby200/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `each'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `block in top_level'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:78:in `block in run'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/capistrano-3.0.0/lib/capistrano/application.rb:12:in `run'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/capistrano-3.0.0/bin/cap:3:in `<top (required)>'
C:/Ruby200/bin/cap:23:in `load'
C:/Ruby200/bin/cap:23:in `<main>'
Tasks: TOP => deploy:restart
My deploy.rb task about the restart looks like this:
set :default_env, { rvm_bin_path: '~/.rvm/bin' }
set :rails_env, "production"
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
within release_path do
execute "bundle exec thin restart -O -C config/thin/production.yml"
end
end
end
end
The correct syntax is:
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
within release_path do
execute :bundle, "exec thin restart -O -C config/thin/production.yml"
end
end
end
before :restart, 'rvm:hook'
end
With a very strange exception. The funny thing is that when I ssh to the server, navigate to the current release dir and execute that command manually it runs correctly. Maybe you'll see something I don't:
http://www.capistranorb.com/documentation/faq/why-does-something-work-in-my-ssh-session-but-not-in-capistrano/
I'd try working through some of the suggestions to debug this listed there.