validate_unique_of().scoped_to() causing RecordNotFound error - ruby-on-rails-4

I recently upgraded my app from Rails 3 to Rails 4, and am now trying to get the unit tests to run. But I'm running into a strange error in two places where we use validate_uniqueness_of().scoped_to().
This is the full error in one of the cases:
1) Distribution should require case sensitive unique value for collaborator_id scoped to variant_id
Failure/Error: it { should validate_uniqueness_of(:collaborator_id).scoped_to(:variant_id) }
ActiveRecord::RecordNotFound:
Couldn't find Distribution with 'id'=first
# ./spec/models/distribution_spec.rb:18:in `block (2 levels) in <top (required)>'
The test file, /spec/models/distribution_spec.rb, contains:
subject { distribution }
let(:distribution) { create :distribution }
it { should validate_uniqueness_of(:collaborator_id).scoped_to(:variant_id) }
And the model, /app/models/distribution.rb, contains:
validates_uniqueness_of :collaborator_id, :scope => :variant_id
I've looked at reports of similar errors, but I couldn't find any with the 'id'=first issue.
EDIT: Full backtrace
# ./vendor/ruby/2.1.0/gems/activerecord-4.2.11.1/lib/active_record/relation/finder_methods.rb:324:in `raise_record_not_found_exception!'
# ./vendor/ruby/2.1.0/gems/activerecord-4.2.11.1/lib/active_record/relation/finder_methods.rb:444:in `find_one'
# ./vendor/ruby/2.1.0/gems/activerecord-4.2.11.1/lib/active_record/relation/finder_methods.rb:423:in `find_with_ids'
# ./vendor/ruby/2.1.0/gems/activerecord-4.2.11.1/lib/active_record/relation/finder_methods.rb:71:in `find'
# ./vendor/ruby/2.1.0/gems/activerecord-4.2.11.1/lib/active_record/querying.rb:3:in `find'
# ./vendor/ruby/2.1.0/gems/composite_primary_keys-8.1.6/lib/composite_primary_keys/core.rb:25:in `find'
# ./vendor/ruby/2.1.0/gems/shoulda-matchers-1.2.0/lib/shoulda/matchers/active_model/validate_uniqueness_of_matcher.rb:80:in `has_existing?'
# ./vendor/ruby/2.1.0/gems/shoulda-matchers-1.2.0/lib/shoulda/matchers/active_model/validate_uniqueness_of_matcher.rb:71:in `matches?'
# ./vendor/ruby/2.1.0/gems/rspec-expectations-3.3.1/lib/rspec/matchers/matcher_delegator.rb:14:in `method_missing'
# ./vendor/ruby/2.1.0/gems/rspec-expectations-3.3.1/lib/rspec/expectations/handler.rb:50:in `block in handle_matcher'
# ./vendor/ruby/2.1.0/gems/rspec-expectations-3.3.1/lib/rspec/expectations/handler.rb:27:in `with_matcher'
# ./vendor/ruby/2.1.0/gems/rspec-expectations-3.3.1/lib/rspec/expectations/handler.rb:48:in `handle_matcher'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/memoized_helpers.rb:81:in `should'
# ./spec/models/distribution_spec.rb:18:in `block (2 levels) in <top (required)>'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:206:in `instance_exec'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:206:in `block in run'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:430:in `block in with_around_and_singleton_context_hooks'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:388:in `block in with_around_example_hooks'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb:478:in `block in run'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb:618:in `block in run_around_example_hooks_for'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:273:in `call'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:273:in `call'
# ./vendor/ruby/2.1.0/gems/rspec-rails-3.3.3/lib/rspec/rails/adapters.rb:127:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:378:in `instance_exec'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:378:in `instance_exec'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb:389:in `execute_with'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb:620:in `block (2 levels) in run_around_example_hooks_for'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:273:in `call'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:273:in `call'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb:621:in `run_around_example_hooks_for'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb:478:in `run'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:388:in `with_around_example_hooks'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:430:in `with_around_and_singleton_context_hooks'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example.rb:203:in `run'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:559:in `block in run_examples'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:555:in `map'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:555:in `run_examples'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb:521:in `run'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:115:in `block (3 levels) in run_specs'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:115:in `map'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:115:in `block (2 levels) in run_specs'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb:1627:in `with_suite_hooks'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:114:in `block in run_specs'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/reporter.rb:77:in `report'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:113:in `run_specs'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:89:in `run'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:73:in `run'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb:41:in `invoke'
# ./vendor/ruby/2.1.0/gems/rspec-core-3.3.2/exe/rspec:4:in `<top (required)>'
# ./vendor/ruby/2.1.0/bin/rspec:23:in `load'
# ./vendor/ruby/2.1.0/bin/rspec:23:in `<main>'

The solution was to upgrade the shoulda-matchers Ruby gem.

Related

undefined method `is_master=' for #<Product:0x0000000b8d5300>

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)>'

Uninitialized constant in rails 4 w/ grape occuring in deployment only

I'm trying to add a Grape (0.9.0) API to my rails app. It's working perfectly hosted locally on the rails server, but when I try to push to my server using capistrano it fails in the precompile:assets step. here is the stack trace from capistrano:
NameError: uninitialized constant API
/home/deploy/pl2/releases/20141224200546/config/routes.rb:4:in `block in <top (required)>'
/home/deploy/pl2/shared/bundle/ruby/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/routing/route_set.rb:337:in `instance_exec'
/home/deploy/pl2/shared/bundle/ruby/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/routing/route_set.rb:337:in `eval_block'
/home/deploy/pl2/shared/bundle/ruby/2.1.0/gems/actionpack-4.1.8/lib/action_dispatch/routing/route_set.rb:315:in `draw'
/home/deploy/pl2/releases/20141224200546/config/routes.rb:1:in `<top (required)>'
/home/deploy/pl2/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
/home/deploy/pl2/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/application/routes_reloader.rb:40:in `each'
/home/deploy/pl2/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/application/routes_reloader.rb:40:in `load_paths'
/home/deploy/pl2/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/application/routes_reloader.rb:16:in `reload!'
/home/deploy/pl2/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/application/routes_reloader.rb:26:in `block in updater'
/home/deploy/pl2/shared/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/file_update_checker.rb:75:in `call'
/home/deploy/pl2/shared/bundle/ruby/2.1.0/gems/activesupport-4.1.8/lib/active_support/file_update_checker.rb:75:in `execute'
/home/deploy/pl2/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/application/routes_reloader.rb:27:in `updater'
/home/deploy/pl2/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
/home/deploy/pl2/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/application/finisher.rb:71:in `block in <module:Finisher>'
/home/deploy/pl2/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/initializable.rb:30:in `instance_exec'
/home/deploy/pl2/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/initializable.rb:30:in `run'
/home/deploy/pl2/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/deploy/pl2/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/initializable.rb:54:in `run_initializers'
/home/deploy/pl2/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/application.rb:300:in `initialize!'
/home/deploy/pl2/releases/20141224200546/config/environment.rb:5:in `<top (required)>'
/home/deploy/pl2/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/application.rb:276:in `require_environment!'
/home/deploy/pl2/shared/bundle/ruby/2.1.0/gems/railties-4.1.8/lib/rails/application.rb:389:in `block in run_tasks_blocks'
/home/deploy/pl2/shared/bundle/ruby/2.1.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:54:in `block (2 levels) in define'
Tasks: TOP => environment
(See full trace by running task with --trace)
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/sshkit-1.6.1/lib/sshkit/command.rb:97:in `exit_status='
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/sshkit-1.6.1/lib/sshkit/backends/netssh.rb:153:in `block (5 levels) in _execute'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `call'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `do_request'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:561:in `channel_request'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:269:in `wait'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/sshkit-1.6.1/lib/sshkit/backends/netssh.rb:175:in `block (3 levels) in _execute'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `call'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/sshkit-1.6.1/lib/sshkit/backends/netssh.rb:177:in `block (2 levels) in _execute'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/sshkit-1.6.1/lib/sshkit/backends/netssh.rb:191:in `with_ssh'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/sshkit-1.6.1/lib/sshkit/backends/netssh.rb:136:in `block in _execute'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/sshkit-1.6.1/lib/sshkit/backends/netssh.rb:133:in `tap'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/sshkit-1.6.1/lib/sshkit/backends/netssh.rb:133:in `_execute'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/sshkit-1.6.1/lib/sshkit/backends/netssh.rb:66:in `execute'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/capistrano-rails-1.1.2/lib/capistrano/tasks/assets.rake:59:in `block (6 levels) in <top (required)>'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/sshkit-1.6.1/lib/sshkit/backends/abstract.rb:85:in `with'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/capistrano-rails-1.1.2/lib/capistrano/tasks/assets.rake:58:in `block (5 levels) in <top (required)>'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/sshkit-1.6.1/lib/sshkit/backends/abstract.rb:77:in `within'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/capistrano-rails-1.1.2/lib/capistrano/tasks/assets.rake:57:in `block (4 levels) in <top (required)>'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/sshkit-1.6.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/sshkit-1.6.1/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/briankeane/.rvm/gems/ruby-2.1.2/gems/sshkit-1.6.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
Tasks: TOP => deploy:assets:precompile
in config/application.rb:
module Web
class Application < Rails::Application
config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]
# ... etc
end
end
in config/routes.rb
Rails.application.routes.draw do
mount API::Root => "/" # this is throwing the error (routes.rb:4)
# ... other routes
end
app/api/API/root.rb:
module API
class Root < Grape::API
prefix "api"
mount API::V1::Root
end
end
app/api/API/V1/root.rb
module API
module V1
class Root < Grape::API
version "v1"
format :json
#error_format :json
# load the rest of the API
mount API::V1::Songs
end
end
end
and finally, app/api/API/V1/songs.rb
module API
module V1
class Songs < Grape::API
# /api/users
version "v1"
format :json
resource :songs do
desc "get a song"
params do
requires :id, type: Integer, desc: "song_id"
end
route_param :id do
get do
{ title: 'test' }
end
end
end
end
end
end
Everything seems to work fine on my local machine, even when I set RAILS_ENV=production. There ia a similar question here, but since it works locally I don't think that's the problem. Thanks!
got same issue. I think autoload_paths and paths configurations is the point.
this is files structure:
app
└── api
   └── API
   ├── V1
   │   └── songs.rb
   └── root.rb
so when I changed config/application.rb to:
module Web
class Application < Rails::Application
config.paths.add File.join('app', 'api'), glob: File.join('**', '**', '*.rb')
config.autoload_paths += Dir[Rails.root.join('app', 'api', '**', '**', '*')]
# ... etc
end
end
everything just worked.
I'm still looking for a better solution, but here's the hacky thing I did in the meantime to get it up and running just in case someone's experiencing the same issue and needs a quick fix:
At the top of my routes.rb file:
require_relative '../app/api/API/root.rb'
Then in ap/api/API/v1/root.rb:
require_relative 'auth.rb'
require_relative 'songs.rb'
require_relative 'users.rb'
Again -- not thrilled about this solution so any additional help is much appreciated.

sidekiq mongoid 4 not working

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

capistrano 3, rails 4, thin server strange exception

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.

Redmine Digest version 2.2.2.stable

I have installed https://github.com/drewkeller/redmine_digest plugin but for the life of me cant set up a cron to run it daily .
Can anyone help a poor boy out ?
root#ip-10-202-39-172:/home/bitnami/apps/redmine/htdocs/bin# rake redmine:send_digest start=1 days=1 project=myproject Rails.env="productio" --trace
(in /opt/bitnami/apps/redmine/htdocs)
** Invoke redmine:send_digest (first_time)
** Execute redmine:send_digest
rake aborted!
string not matched
/opt/bitnami/apps/redmine/htdocs/plugins/redmine_digest/lib/tasks/digest.rake:47:in `[]='
/opt/bitnami/apps/redmine/htdocs/plugins/redmine_digest/lib/tasks/digest.rake:47:in `block (2 levels) in <top (required)>'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/opt/bitnami/ruby/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/opt/bitnami/ruby/bin/rake:23:in `load'
/opt/bitnami/ruby/bin/rake:23:in `<main>'
Tasks: TOP => redmine:send_digest
root#ip-10-202-39-172:/home/bitnami/apps/redmine/htdocs/bin#
root#ip-10-202-39-172:/home/bitnami/apps/redmine/htdocs/bin# rake redmine:send_digest start=1 days=1 project=SSO Rails.env="productio" --trace
(in /opt/bitnami/apps/redmine/htdocs)
** Invoke redmine:send_digest (first_time)
** Execute redmine:send_digest
rake aborted!
string not matched
/opt/bitnami/apps/redmine/htdocs/plugins/redmine_digest/lib/tasks/digest.rake:47:in `[]='
/opt/bitnami/apps/redmine/htdocs/plugins/redmine_digest/lib/tasks/digest.rake:47:in `block (2 levels) in <top (required)>'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/opt/bitnami/ruby/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/opt/bitnami/ruby/bin/rake:23:in `load'
/opt/bitnami/ruby/bin/rake:23:in `<main>'
Tasks: TOP => redmine:send_digest
root#ip-10-202-39-172:/home/bitnami/apps/redmine/htdocs/bin#
Redmine 2.2.2.stable
Default administrator account changed
Attachments directory writable
Plugin assets directory writable
RMagick available (optional)
Environment:
Redmine version 2.2.2.stable
Ruby version 1.9.3 (x86_64-linux)
Rails version 3.2.11
Environment production
Database adapter Mysql2
Redmine plugins:
openid_fix 0.1.0
redmine_digest 0.2.0
redmine_googlesss 0.0.2
Some other people have reported issues with line 47 in the rake.digest file. You could try the same workaround: https://github.com/drewkeller/redmine_digest/issues/29
Also see https://github.com/drewkeller/redmine_digest/issues/36. Looks like you crossposted your question.