diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2017-05-29 18:01:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-29 18:01:50 +0200 |
commit | 1c275d812f35f53f93cd96184a4f319983766cc5 (patch) | |
tree | b063afeb12dd369f358ad18517e5e8915455df0e /activejob/lib | |
parent | edc90c858d4cbf1a8e4bfb7347b34348bb30e92c (diff) | |
download | rails-1c275d812f35f53f93cd96184a4f319983766cc5.tar.gz rails-1c275d812f35f53f93cd96184a4f319983766cc5.tar.bz2 rails-1c275d812f35f53f93cd96184a4f319983766cc5.zip |
Add option for class_attribute default (#29270)
* Allow a default value to be declared for class_attribute
* Convert to using class_attribute default rather than explicit setter
* Removed instance_accessor option by mistake
* False is a valid default value
* Documentation
Diffstat (limited to 'activejob/lib')
-rw-r--r-- | activejob/lib/active_job/queue_name.rb | 7 | ||||
-rw-r--r-- | activejob/lib/active_job/queue_priority.rb | 4 |
2 files changed, 3 insertions, 8 deletions
diff --git a/activejob/lib/active_job/queue_name.rb b/activejob/lib/active_job/queue_name.rb index 352cf62424..d83113af60 100644 --- a/activejob/lib/active_job/queue_name.rb +++ b/activejob/lib/active_job/queue_name.rb @@ -32,11 +32,8 @@ module ActiveJob end included do - class_attribute :queue_name, instance_accessor: false - class_attribute :queue_name_delimiter, instance_accessor: false - - self.queue_name = default_queue_name - self.queue_name_delimiter = "_" # set default delimiter to '_' + class_attribute :queue_name, instance_accessor: false, default: default_queue_name + class_attribute :queue_name_delimiter, instance_accessor: false, default: "_" end # Returns the name of the queue the job will be run on. diff --git a/activejob/lib/active_job/queue_priority.rb b/activejob/lib/active_job/queue_priority.rb index b02202fcc8..db8d9178a4 100644 --- a/activejob/lib/active_job/queue_priority.rb +++ b/activejob/lib/active_job/queue_priority.rb @@ -27,9 +27,7 @@ module ActiveJob end included do - class_attribute :priority, instance_accessor: false - - self.priority = default_priority + class_attribute :priority, instance_accessor: false, default: default_priority end # Returns the priority that the job will be created with |