class Madmin::Generators::FieldGenerator

Public Instance Methods

eager_load() click to toggle source
# File lib/generators/madmin/field/field_generator.rb, line 8
def eager_load
  Rails.application.eager_load!
end
generate_field() click to toggle source
# 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

Private Instance Methods

copy_resource_template(template_name) click to toggle source
# File lib/generators/madmin/field/field_generator.rb, line 21
def copy_resource_template(template_name)
  template_file = "#{template_name}.html.erb"

  copy_file(
    template_file,
    "app/views/madmin/fields/#{file_path}_field/#{template_file}"
  )
end