Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rake schedulable:build_occurrences failing #6

Closed
scottdc opened this issue Apr 16, 2015 · 8 comments
Closed

rake schedulable:build_occurrences failing #6

scottdc opened this issue Apr 16, 2015 · 8 comments

Comments

@scottdc
Copy link

scottdc commented Apr 16, 2015

In my app I have a jobs model which is schedulable and has occurrences. When I create a new job the occurrences are correctly created but when I run rake schedulable:build_occurrences it fails. Totally stumped by this one. Trace below.

rake schedulable:build_occurrences --trace
** Invoke schedulable:build_occurrences (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute schedulable:build_occurrences
rake aborted!
ArgumentError: wrong number of arguments (1 for 0)
/Users/scott/.rvm/gems/ruby-2.1.0/gems/activerecord-4.2.0/lib/active_record/scoping/named.rb:24:in all' /Users/scott/.rvm/gems/ruby-2.1.0/gems/schedulable-0.0.7/lib/tasks/schedulable_tasks.rake:5:inblock (2 levels) in <top (required)>'
/Users/scott/.rvm/gems/ruby-2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in call' /Users/scott/.rvm/gems/ruby-2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:inblock in execute'
/Users/scott/.rvm/gems/ruby-2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in each' /Users/scott/.rvm/gems/ruby-2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:inexecute'
/Users/scott/.rvm/gems/ruby-2.1.0/gems/rake-10.4.2/lib/rake/task.rb:179:in block in invoke_with_call_chain' /Users/scott/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/monitor.rb:211:inmon_synchronize'
/Users/scott/.rvm/gems/ruby-2.1.0/gems/rake-10.4.2/lib/rake/task.rb:172:in invoke_with_call_chain' /Users/scott/.rvm/gems/ruby-2.1.0/gems/rake-10.4.2/lib/rake/task.rb:165:ininvoke'
/Users/scott/.rvm/gems/ruby-2.1.0/gems/rake-10.4.2/lib/rake/application.rb:150:in invoke_task' /Users/scott/.rvm/gems/ruby-2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:inblock (2 levels) in top_level'
/Users/scott/.rvm/gems/ruby-2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in each' /Users/scott/.rvm/gems/ruby-2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:inblock in top_level'
/Users/scott/.rvm/gems/ruby-2.1.0/gems/rake-10.4.2/lib/rake/application.rb:115:in run_with_threads' /Users/scott/.rvm/gems/ruby-2.1.0/gems/rake-10.4.2/lib/rake/application.rb:100:intop_level'
/Users/scott/.rvm/gems/ruby-2.1.0/gems/rake-10.4.2/lib/rake/application.rb:78:in block in run' /Users/scott/.rvm/gems/ruby-2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:instandard_exception_handling'
/Users/scott/.rvm/gems/ruby-2.1.0/gems/rake-10.4.2/lib/rake/application.rb:75:in run' /Users/scott/.rvm/gems/ruby-2.1.0/gems/rake-10.4.2/bin/rake:33:in<top (required)>'
/Users/scott/.rvm/gems/ruby-2.1.0/bin/rake:23:in load' /Users/scott/.rvm/gems/ruby-2.1.0/bin/rake:23:in

'
/Users/scott/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in eval' /Users/scott/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in'
Tasks: TOP => schedulable:build_occurrences

@rexblack
Copy link
Member

I am very sorry for the delay.
Many thanks for posting the issue.
The issue is fixed on master now. A new release will follow shortly...

@scottdc
Copy link
Author

scottdc commented Apr 29, 2015

Awesome, thanks!

@rexblack
Copy link
Member

rexblack commented May 1, 2015

This is fixed with current release v0.0.8.

@rexblack rexblack closed this as completed May 1, 2015
@dsgrafiniert
Copy link

Still have a problem here with v0.0.8:

rake schedulable:build_occurrences
build occurrences...
rake aborted!
NoMethodError: undefined method `schedulable' for nil:NilClass

/Users//.rvm/gems/ruby-2.2.2/gems/schedulable-0.0.8/lib/schedulable/acts_as_schedulable.rb:78:in block in acts_as_schedulable' /Users/_/.rvm/gems/ruby-2.2.2/gems/schedulable-0.0.8/lib/schedulable/acts_as_schedulable.rb:60:in block (3 levels) in acts_as_schedulable'
/Users/*/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.4/lib/active_record/relation/delegation.rb:46:ineach' /Users/_/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.4/lib/active_record/relation/delegation.rb:46:in each'
/Users/
/.rvm/gems/ruby-2.2.2/gems/schedulable-0.0.8/lib/schedulable/acts_as_schedulable.rb:59:in block (2 levels) in acts_as_schedulable' /Users/*/*/*/lib/tasks/schedulable_tasks.rake:9:inblock (4 levels) in <top (required)>'
/Users////lib/tasks/schedulable_tasks.rake:8:in each' /Users/_/_/_/lib/tasks/schedulable_tasks.rake:8:in block (3 levels) in <top (required)>'
/Users/*/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.4/lib/active_record/relation/delegation.rb:46:ineach' /Users/_/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.4/lib/active_record/relation/delegation.rb:46:in each'
/Users/
///lib/tasks/schedulable_tasks.rake:5:in `block (2 levels) in <top (required)>'

@rexblack
Copy link
Member

Hi dsgrafiniert,
i cannot reproduce the exception with current master version when testing with the dummy app under Ruby v2.1.2p95 and Rails v4.2.4.

Please try installing from master by putting the following in your Gemfile:

gem "schedulable", github: 'benignware/schedulable'

Maybe the error is due to a specific ruby or rails version. Please determine your versions by running ruby -v respectively rails -v and post here.

Since the stack trace points to line 78 where the schedulable object, e.g. an event, is referenced, it is also likely that there is something wrong with db schema regarding polymorphic association.

Check your schema.db if the schedules table contains the following fields:

t.integer  "schedulable_id"
t.string   "schedulable_type"

You could also try to checkout the gem's source code and reproduce the issue with the dummy app. This would be very helpful in order to fix it.
I'll reopen the issue when we got some more hints on it and i'll be able to reproduce it.

Many thanks and best regards,
Rafael

@rexblack
Copy link
Member

rexblack commented Oct 5, 2015

A new release is available. Please checkout v0.0.9 and test if the issue still persists. Thank you.
Regards,
Rafael

@taelton
Copy link

taelton commented Apr 15, 2016

I am also getting "NoMethodError: undefined method `schedulable' for nil:NilClass". Can we reopen this issue?

ruby -v
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]
rails -v
Rails 4.1.0
rake schedulable:build_occurrences
rake aborted!
NoMethodError: undefined method `schedulable' for nil:NilClass
/home/nitrous/code/boomshift/.bundle/bundler/gems/schedulable-b4cac8fd548b/lib/schedulable/acts_as_schedulable.rb:83:in `block in acts_as_schedulable'
/home/nitrous/code/boomshift/.bundle/bundler/gems/schedulable-b4cac8fd548b/lib/schedulable/acts_as_schedulable.rb:60:in `block (3 levels) in acts_as_schedulable'
/home/nitrous/code/boomshift/.bundle/gems/activerecord-4.1.0/lib/active_record/relation/delegation.rb:46:in `each'
/home/nitrous/code/boomshift/.bundle/gems/activerecord-4.1.0/lib/active_record/relation/delegation.rb:46:in `each'
/home/nitrous/code/boomshift/.bundle/bundler/gems/schedulable-b4cac8fd548b/lib/schedulable/acts_as_schedulable.rb:59:in `block (2 levels) in acts_as_schedulable'
/home/nitrous/code/boomshift/.bundle/bundler/gems/schedulable-b4cac8fd548b/lib/tasks/schedulable_tasks.rake:9:in `block (4 levels) in <top (required)>'
/home/nitrous/code/boomshift/.bundle/bundler/gems/schedulable-b4cac8fd548b/lib/tasks/schedulable_tasks.rake:8:in `each'
/home/nitrous/code/boomshift/.bundle/bundler/gems/schedulable-b4cac8fd548b/lib/tasks/schedulable_tasks.rake:8:in `block (3 levels) in <top (required)>'
/home/nitrous/code/boomshift/.bundle/bundler/gems/schedulable-b4cac8fd548b/lib/tasks/schedulable_tasks.rake:5:in `each'
/home/nitrous/code/boomshift/.bundle/bundler/gems/schedulable-b4cac8fd548b/lib/tasks/schedulable_tasks.rake:5:in `block (2 levels) in <top (required)>'
.bundle/binstubs/rake:16:in `load'
.bundle/binstubs/rake:16:in `<main>'
Tasks: TOP => schedulable:build_occurrences
(See full trace by running task with --trace)

Here's the full trace:

rake schedulable:build_occurrences --trace
** Invoke schedulable:build_occurrences (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute schedulable:build_occurrences
rake aborted!
NoMethodError: undefined method `schedulable' for nil:NilClass
/home/nitrous/code/boomshift/.bundle/bundler/gems/schedulable-b4cac8fd548b/lib/schedulable/acts_as_schedulable.rb:83:in `block in acts_as_schedulable'
/home/nitrous/code/boomshift/.bundle/bundler/gems/schedulable-b4cac8fd548b/lib/schedulable/acts_as_schedulable.rb:60:in `block (3 levels) in acts_as_schedulable'
/home/nitrous/code/boomshift/.bundle/gems/activerecord-4.1.0/lib/active_record/relation/delegation.rb:46:in `each'
/home/nitrous/code/boomshift/.bundle/gems/activerecord-4.1.0/lib/active_record/relation/delegation.rb:46:in `each'
/home/nitrous/code/boomshift/.bundle/bundler/gems/schedulable-b4cac8fd548b/lib/schedulable/acts_as_schedulable.rb:59:in `block (2 levels) in acts_as_schedulable'
/home/nitrous/code/boomshift/.bundle/bundler/gems/schedulable-b4cac8fd548b/lib/tasks/schedulable_tasks.rake:9:in `block (4 levels) in <top (required)>'
/home/nitrous/code/boomshift/.bundle/bundler/gems/schedulable-b4cac8fd548b/lib/tasks/schedulable_tasks.rake:8:in `each'
/home/nitrous/code/boomshift/.bundle/bundler/gems/schedulable-b4cac8fd548b/lib/tasks/schedulable_tasks.rake:8:in `block (3 levels) in <top (required)>'
/home/nitrous/code/boomshift/.bundle/bundler/gems/schedulable-b4cac8fd548b/lib/tasks/schedulable_tasks.rake:5:in `each'
/home/nitrous/code/boomshift/.bundle/bundler/gems/schedulable-b4cac8fd548b/lib/tasks/schedulable_tasks.rake:5:in `block (2 levels) in <top (required)>'
/home/nitrous/code/boomshift/.bundle/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/home/nitrous/code/boomshift/.bundle/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/home/nitrous/code/boomshift/.bundle/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/home/nitrous/code/boomshift/.bundle/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/home/nitrous/code/boomshift/.bundle/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/local/opt/rbenv/versions/2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/home/nitrous/code/boomshift/.bundle/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/nitrous/code/boomshift/.bundle/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/home/nitrous/code/boomshift/.bundle/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/home/nitrous/code/boomshift/.bundle/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/nitrous/code/boomshift/.bundle/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/home/nitrous/code/boomshift/.bundle/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/home/nitrous/code/boomshift/.bundle/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/home/nitrous/code/boomshift/.bundle/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/home/nitrous/code/boomshift/.bundle/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/home/nitrous/code/boomshift/.bundle/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/nitrous/code/boomshift/.bundle/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/home/nitrous/code/boomshift/.bundle/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
.bundle/binstubs/rake:16:in `load'
.bundle/binstubs/rake:16:in `<main>'
Tasks: TOP => schedulable:build_occurrences

@rexblack
Copy link
Member

Yes, I can now reproduce the issue now and reopen it

@rexblack rexblack reopened this Apr 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants