Sha256: 992267b84d091de52d79e19ac91ecb274884f7d8cfe027bf988e8b95d7d88f7d

Contents?: true

Size: 725 Bytes

Versions: 1

Compression:

Stored size: 725 Bytes

Contents

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

class ActsAsFollowerGenerator < Rails::Generators::Base

    include Rails::Generators::Migration

    def self.source_root
        @source_root ||= File.join File.dirname(__FILE__), 'templates'
    end

    def self.next_migration_number dirname
        if ActiveRecord::Base.timestamped_migrations
            Time.now.utc.strftime '%Y%m%d%H%M%S'
        else
            "%.3d" % (current_migration_number(dirname) + 1)
        end
    end

    def create_migration_file
        migration_template 'migration.rb.erb', 'db/migrate/acts_as_favoritor_migration.rb'
    end

    def create_model
        template 'model.rb', 'app/models/follow.rb'
    end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acts_as_favoritor-1.0.0 lib/generators/acts_as_follower_generator.rb