Sha256: 009426abb0ee3d431b7b951051631bc65d674eab75135bd0f7856742693ce956

Contents?: true

Size: 859 Bytes

Versions: 4

Compression:

Stored size: 859 Bytes

Contents

require 'rails/generators/active_record/model/model_generator'

module ActiveRecord
  module Generators
    class ModelGenerator

      def create_migration_file
        # return unless options[:migration] && options[:parent].nil?
        attributes.each { |a| a.attr_options.delete(:index) if a.reference? && !a.has_index? } if options[:indexes] == false
        migration_template "../../migration/templates/create_table_migration.rb", "db/migrate/create_#{table_name}.rb"
      end

      def generate_locale_file
        invoke("locale:model", [name]) if ActiveGenerator.configuration.autoload_model_generator_locale
      end

      def generate_test_file
        unless ActiveGenerator.configuration.test_framework.nil?
          invoke("#{ActiveGenerator.configuration.test_framework}:model", [name]) rescue nil
        end
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
active_generator-2.2.8 lib/generators/rails/model_generator.rb
active_generator-2.2.7 lib/generators/rails/model_generator.rb
active_generator-2.2.6 lib/generators/rails/model_generator.rb
active_generator-2.2.5 lib/generators/rails/model_generator.rb