Sha256: 275446cbba2d8e230cba69aa8617e71519399af7216f89d8f9badd0b2efab73e

Contents?: true

Size: 1003 Bytes

Versions: 3

Compression:

Stored size: 1003 Bytes

Contents

require 'rails/generators/migration'
require 'rails/generators/active_record'

###
# MentionSystemGenerator class
#
# This class generates the mention model migration in mention system
###
class MentionSystemGenerator < Rails::Generators::Base
  ###
  # Includes Rails::Generators::Migration
  ###
  include Rails::Generators::Migration

  ###
  # Generator description definition
  ###
  desc "Generates a migration for the Mention model"

  ###
  # Retrieves the source root
  #
  # @return [String]
  ###
  def self.source_root
    @source_root ||= File.dirname(__FILE__) + '/templates'
  end

  ###
  # Retrieves the next migration number
  #
  # @path [String] path - the path to calculate the next migration number
  # @return [String]
  ###
  def self.next_migration_number(path)
    ActiveRecord::Generators::Base.next_migration_number(path)
  end

  ###
  # Generates the migration
  ###
  def generate_migration
    migration_template 'migration.rb', 'db/migrate/create_mentions.rb'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mention_system-0.3.1 lib/generators/mention_system/mention_system_generator.rb
mention_system-0.3.0 lib/generators/mention_system/mention_system_generator.rb
mention_system-0.2.0 lib/generators/mention_system/mention_system_generator.rb