Sha256: 1085950130acf0ca36a5f614d6d9216645227a9f7c79cb70e852064c455156d9

Contents?: true

Size: 690 Bytes

Versions: 2

Compression:

Stored size: 690 Bytes

Contents

require 'rails/generators/migration'

module ActsAsFriendable
  module Generators
    class InstallGenerator < ::Rails::Generators::Base
      include Rails::Generators::Migration
      source_root File.expand_path('../templates', __FILE__)
      desc "Generates Friendship migration"

      def self.next_migration_number(path)
        unless @prev_migration_nr
          @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
        else
          @prev_migration_nr += 1
        end
        @prev_migration_nr.to_s
      end

      def copy_migration
        migration_template 'friendships.rb', 'db/migrate/create_acts_as_friendable_friendships.rb'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
acts_as_friendable-1.0.1 lib/generators/acts_as_friendable/install/install_generator.rb
acts_as_friendable-1.0.0 lib/generators/acts_as_friendable/install/install_generator.rb