lib/rocket_job/plugins/cron.rb in rocketjob-2.1.3 vs lib/rocket_job/plugins/cron.rb in rocketjob-3.0.0.alpha
- old
+ new
@@ -38,13 +38,11 @@
#
# class MyCronJob < RocketJob::Job
# include RocketJob::Plugins::Cron
#
# # Set the default cron_schedule
- # rocket_job do |job|
- # job.cron_schedule = "* 1 * * * UTC"
- # end
+ # self.cron_schedule = "* 1 * * * UTC"
#
# def perform
# puts "DONE"
# end
# end
@@ -68,13 +66,11 @@
# include RocketJob::Plugins::Cron
# # Prevents mutiple instances from being queued or run at the same time
# include RocketJob::Plugins::Singleton
#
# # Set the default cron_schedule
- # rocket_job do |job|
- # job.cron_schedule = "* 1 * * * UTC"
- # end
+ # self.cron_schedule = "* 1 * * * UTC"
#
# def perform
# puts "DONE"
# end
# end
@@ -103,13 +99,10 @@
extend ActiveSupport::Concern
included do
include Restart
- key :cron_schedule, String
-
- # Make cron_schedule editable for scheduled jobs
- public_rocket_job_properties :cron_schedule
+ field :cron_schedule, type: String, class_attribute: true, user_editable: true
before_create :rocket_job_set_run_at
validates_presence_of :cron_schedule
validates_each :cron_schedule do |record, attr, value|