Class: Dis::Generators::ModelGenerator

Inherits:
Rails::Generators::ModelGenerator
  • Object
show all
Defined in:
lib/rails/generators/dis/model/model_generator.rb

Instance Method Summary collapse

Constructor Details

#initialize(args, *options) ⇒ ModelGenerator

Returns a new instance of ModelGenerator.



11
12
13
# File 'lib/rails/generators/dis/model/model_generator.rb', line 11

def initialize(args, *options)
  super(inject_dis_attributes(args), *options)
end

Instance Method Details

#add_model_extensionObject



15
16
17
18
19
20
21
22
# File 'lib/rails/generators/dis/model/model_generator.rb', line 15

def add_model_extension
  inject_into_file(
    File.join("app/models", class_path, "#{file_name}.rb"),
    after: "ActiveRecord::Base\n"
  ) do
    "  include Dis::Model\n"
  end
end