Sha256: 67ec1a62b56d19005f45a0d438fba980ac02ba19e9cfbcdfcf2c5edf0d950506

Contents?: true

Size: 844 Bytes

Versions: 2

Compression:

Stored size: 844 Bytes

Contents

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

module MysteriousTravellerTestGemFlex
  module Generators
    class TeamGenerator < Rails::Generators::NamedBase
      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.new.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', 'db/migrate/create_team_members_table.rb'
      end

      def create_model_file
        model_path = "app/models/coupon.rb"
        template "coupon.rb", model_path
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mysterious_traveller_test_gem_flex-0.3.8 lib/generators/mysterious_traveller_test_gem_flex/team_generator.rb
mysterious_traveller_test_gem_flex-0.3.7 lib/generators/mysterious_traveller_test_gem_flex/team_generator.rb