Class: IronAdmin::Generators::ResourceGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/iron_admin/resource/resource_generator.rb

Overview

Generator for creating new IronAdmin resource definitions.

Creates a resource file in app/iron_admin/ that configures how a model appears in the admin panel.

Examples:

Generate a resource for User model

rails generate iron_admin:resource User

Generate a namespaced resource

rails generate iron_admin:resource Admin::User

See Also:

Instance Method Summary collapse

Instance Method Details

#create_resource_filevoid

This method returns an undefined value.

Creates the resource file from template.



22
23
24
# File 'lib/generators/iron_admin/resource/resource_generator.rb', line 22

def create_resource_file
  template "resource.rb.tt", File.join("app/iron_admin/resources", class_path, "#{file_name}_resource.rb")
end