class ActiveRecord::WorkflowModelGenerator
Attributes
job[R]
add a new attribute to the generator the workflow needs to know what the job model is to render the template properly
Public Class Methods
new(args, *options)
click to toggle source
jobs is a new attribute type, like “references”, so we can let the user specify the corresponding job model. This attribute is used in the workflow_model.rb template file. i.e.
rails g osc_machete_rails:workflow_model Container name:string container_job:jobs
Calls superclass method
# File lib/generators/active_record/workflow_model_generator.rb, line 20 def initialize(args, *options) @job = parse_job!(args) super end
Public Instance Methods
create_model_file()
click to toggle source
overrides original ModelGenerator#create_model_file to make a workflow_model instead of a model since we are inheriting from ModelGenerator, we get the tests and all the other good stuff
# File lib/generators/active_record/workflow_model_generator.rb, line 27 def create_model_file template 'workflow_model.rb', File.join('app/models', class_path, "#{file_name}.rb") end