Sha256: 14a57b1a47ed1d3f44956529d36ec55bd18c8122b0b5cd779344665393b0ee65

Contents?: true

Size: 986 Bytes

Versions: 6

Compression:

Stored size: 986 Bytes

Contents

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

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

  ###
  # Generator description definition
  ###
  desc "Generates a migration for the Like 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_likes.rb'
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
like_system-0.1.1 lib/generators/like_system/like_system_generator.rb
like_system-0.1.0 lib/generators/like_system/like_system_generator.rb
like_system-0.0.9 lib/generators/like_system/like_system_generator.rb
like_system-0.0.8 lib/generators/like_system/like_system_generator.rb
like_system-0.0.7 lib/generators/like_system/like_system_generator.rb
like_system-0.0.6 lib/generators/like_system/like_system_generator.rb