Class: HasPermalinkGenerator

Inherits:
ActiveRecord::Generators::Base
  • Object
show all
Defined in:
lib/generators/has_permalink_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



6
7
8
# File 'lib/generators/has_permalink_generator.rb', line 6

def self.source_root
  @source_root ||= File.expand_path('../templates', __FILE__)
end

Instance Method Details

#generate_migrationObject



10
11
12
# File 'lib/generators/has_permalink_generator.rb', line 10

def generate_migration
  migration_template "has_permalink_migration.rb.erb", "db/migrate/#{migration_file_name}"
end

#migration_class_nameObject



22
23
24
# File 'lib/generators/has_permalink_generator.rb', line 22

def migration_class_name
  migration_name.camelize
end

#migration_file_nameObject



18
19
20
# File 'lib/generators/has_permalink_generator.rb', line 18

def migration_file_name
  "#{migration_name}.rb"
end

#migration_nameObject



14
15
16
# File 'lib/generators/has_permalink_generator.rb', line 14

def migration_name
  "add_permalink_to_#{name.underscore}"
end