diff options
author | Cristian Bica <cristian.bica@gmail.com> | 2014-08-12 13:53:46 +0300 |
---|---|---|
committer | Cristian Bica <cristian.bica@gmail.com> | 2014-08-12 13:53:46 +0300 |
commit | 3ed69cd5f54c6eda7ee8664aa14c53205ecbb6c5 (patch) | |
tree | ae592fe3a17ea77536a8b1ab2ddbbefa45dbd2c1 /activejob/lib/rails/generators/job | |
parent | 0c232779ece1ff6bf9bce9d55c54ea19867a2170 (diff) | |
download | rails-3ed69cd5f54c6eda7ee8664aa14c53205ecbb6c5.tar.gz rails-3ed69cd5f54c6eda7ee8664aa14c53205ecbb6c5.tar.bz2 rails-3ed69cd5f54c6eda7ee8664aa14c53205ecbb6c5.zip |
Fixed failing tests; Load active_job in railtie; Renamed generator to job
Diffstat (limited to 'activejob/lib/rails/generators/job')
-rw-r--r-- | activejob/lib/rails/generators/job/job_generator.rb | 22 | ||||
-rw-r--r-- | activejob/lib/rails/generators/job/templates/job.rb | 9 |
2 files changed, 31 insertions, 0 deletions
diff --git a/activejob/lib/rails/generators/job/job_generator.rb b/activejob/lib/rails/generators/job/job_generator.rb new file mode 100644 index 0000000000..78a9c27606 --- /dev/null +++ b/activejob/lib/rails/generators/job/job_generator.rb @@ -0,0 +1,22 @@ +require 'rails/generators/named_base' + +module Rails + module Generators # :nodoc: + class JobGenerator < Rails::Generators::NamedBase # :nodoc: + desc 'This generator creates an active job file at app/jobs' + + class_option :queue, type: :string, default: 'default', desc: 'The queue name for the generated job' + + def self.default_generator_root + File.dirname(__FILE__) + end + + check_class_collision suffix: 'Job' + + def create_job_file + template 'job.rb', File.join('app/jobs', class_path, "#{file_name}_job.rb") + end + + end + end +end diff --git a/activejob/lib/rails/generators/job/templates/job.rb b/activejob/lib/rails/generators/job/templates/job.rb new file mode 100644 index 0000000000..6a21616d30 --- /dev/null +++ b/activejob/lib/rails/generators/job/templates/job.rb @@ -0,0 +1,9 @@ +<% module_namespacing do -%> +class <%= class_name %>Job < ActiveJob::Base + queue_as :<%= options[:queue] %> + + def perform + # Do something later + end +end +<% end -%>
\ No newline at end of file |