blob: 78a9c2760611a9db385f270a5351207eda0c73e4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
|