Sha256: 5851e46d4d09897d358fc52e4eb8ad9f7b6eba1d8604fceee4e38e1095886e24

Contents?: true

Size: 516 Bytes

Versions: 2

Compression:

Stored size: 516 Bytes

Contents

require "rails/generators/active_record"

class ChallahGenerator < Rails::Generators::Base

  include ActiveRecord::Generators::Migration

  source_root File.expand_path("../templates", __FILE__)

  def copy_migration
    migration_template "migration.rb", "db/migrate/challah_create_users.rb", migration_version: migration_version
  end

  def rails5?
    Rails.version.start_with? "5"
  end

  def migration_version
    if rails5?
      "[#{ Rails::VERSION::MAJOR }.#{ Rails::VERSION::MINOR }]"
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
challah-1.6.1 lib/generators/challah_generator.rb
challah-1.6.0 lib/generators/challah_generator.rb