Sha256: b4b51c4cbe0d2a84dffea4b27f74b3885a18426ebe4a0295199b0ea5ddda3cf7
Contents?: true
Size: 846 Bytes
Versions: 1
Compression:
Stored size: 846 Bytes
Contents
require 'rails/generators/active_record/model/model_generator' require 'generators/rails/base' class ActiveRecord::Generators::ModelGenerator include Rails::Base def create_migration_file # return unless options[:migration] && options[:parent].nil? if options[:indexes] == false attributes.each do |attr| attr.attr_options.delete(:index) if attr.reference? && !attr.has_index? end end path = "db/migrate/create_#{table_name}.rb" migration_template('../../migration/templates/create_table_migration.rb', path) end def generate_locale_file invoke('locale:model', [name]) if configuration.autoload_model_generator_locale end def generate_test_file framework = configuration.test_framework return if framework.nil? invoke("#{framework}:model", [name]) rescue nil end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_generator-4.0.1 | lib/generators/rails/model_generator.rb |