Class: UrlSlug::Generators::RailsGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
Rails::Generators::Migration, Actions
Defined in:
lib/generators/url_slug/rails/rails_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dir) ⇒ Object



26
27
28
# File 'lib/generators/url_slug/rails/rails_generator.rb', line 26

def self.next_migration_number(dir)
  ActiveRecord::Generators::Base.next_migration_number(dir)
end

Instance Method Details

#create_url_slug_migrationObject



16
17
18
19
20
21
22
23
24
# File 'lib/generators/url_slug/rails/rails_generator.rb', line 16

def create_url_slug_migration
  return unless include_migration?

  if table_exists?
    create_add_slug_to_table_migration
  else
    puts "#{table_name} table does not exists"
  end
end