class ActiveRecord::Generators::ModelGenerator

:nodoc:
:nodoc:

def attributes_with_index

def attributes_with_index
  attributes.select { |a| !a.reference? && a.has_index? }
end

def create_migration_file

creates the migration file for the model.
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", File.join(db_migrate_path, "create_#{table_name}.rb")
end

def create_model_file

def create_model_file
  template "model.rb", File.join("app/models", class_path, "#{file_name}.rb")
end

def create_module_file

def create_module_file
  return if regular_class_path.empty?
  template "module.rb", File.join("app/models", "#{class_path.join('/')}.rb") if behavior == :invoke
end

def parent_class_name

Used by the migration template to determine the parent name of the model
def parent_class_name
  options[:parent] || "ApplicationRecord"
end