Class: Adminpanel::Generators::ResourceGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(path) ⇒ Object



12
13
14
# File 'lib/generators/adminpanel/resource/resource_generator.rb', line 12

def self.next_migration_number(path)
		Time.now.utc.strftime("%Y%m%d%H%M%S")
end

Instance Method Details

#create_controllerObject



20
21
22
23
24
# File 'lib/generators/adminpanel/resource/resource_generator.rb', line 20

def create_controller
	if is_a_resource?
		template "controller.rb", "app/controllers/adminpanel/#{pluralized_name}_controller.rb"
	end
end

#create_migrationsObject



26
27
28
# File 'lib/generators/adminpanel/resource/resource_generator.rb', line 26

def create_migrations
	migration_template "migration.rb", "db/migrate/create_#{pluralized_name}_table"
end

#create_modelObject



16
17
18
# File 'lib/generators/adminpanel/resource/resource_generator.rb', line 16

def create_model
 		template 'resource.rb', "app/models/adminpanel/#{lower_name}.rb"
end