Class: Madmin::Generators::FieldGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
Madmin::GeneratorHelpers
Defined in:
lib/generators/madmin/field/field_generator.rb

Constant Summary

Constants included from Madmin::GeneratorHelpers

Madmin::GeneratorHelpers::ROUTES_FILE

Instance Method Summary collapse

Methods included from Madmin::GeneratorHelpers

#call_generator, #optimize_indentation, #rails6_1_and_up?, #route, #route_namespace_exists?

Instance Method Details

#eager_loadObject



8
9
10
# File 'lib/generators/madmin/field/field_generator.rb', line 8

def eager_load
  Rails.application.eager_load!
end

#generate_fieldObject



12
13
14
15
16
17
# File 'lib/generators/madmin/field/field_generator.rb', line 12

def generate_field
  template "field.rb", "app/madmin/fields/#{file_path}_field.rb"
  copy_resource_template "_form"
  copy_resource_template "_index"
  copy_resource_template "_show"
end