Class: Trestle::Generators::ResourceGenerator

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

Instance Method Summary collapse

Instance Method Details

#admin_nameObject



14
15
16
# File 'lib/generators/trestle/resource/resource_generator.rb', line 14

def admin_name
  singular? ? singular_name : plural_name
end

#create_adminObject



10
11
12
# File 'lib/generators/trestle/resource/resource_generator.rb', line 10

def create_admin
  template "admin.rb.erb", File.join("app/admin", class_path, "#{admin_name}_admin.rb")
end

#parameter_nameObject



18
19
20
# File 'lib/generators/trestle/resource/resource_generator.rb', line 18

def parameter_name
  singular_name.singularize
end

#singular?Boolean

Returns:

  • (Boolean)


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

def singular?
  options[:singular]
end