diff options
author | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-09-24 14:01:31 -0700 |
---|---|---|
committer | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-09-24 16:11:41 -0700 |
commit | f0dd77c6be6a86fe384bb0015151e0a497973d39 (patch) | |
tree | ad81bb4c807c39edeaa37035882a16d9d95ebaa9 /railties/lib/generators/active_record/model | |
parent | 610b81beca461a6fa4f00c7023e0e4315eb2b8be (diff) | |
download | rails-f0dd77c6be6a86fe384bb0015151e0a497973d39.tar.gz rails-f0dd77c6be6a86fe384bb0015151e0a497973d39.tar.bz2 rails-f0dd77c6be6a86fe384bb0015151e0a497973d39.zip |
Move railties/lib/* into railties/lib/*
Diffstat (limited to 'railties/lib/generators/active_record/model')
3 files changed, 0 insertions, 54 deletions
diff --git a/railties/lib/generators/active_record/model/model_generator.rb b/railties/lib/generators/active_record/model/model_generator.rb deleted file mode 100644 index 2641083e0d..0000000000 --- a/railties/lib/generators/active_record/model/model_generator.rb +++ /dev/null @@ -1,33 +0,0 @@ -require 'generators/active_record' - -module ActiveRecord - module Generators - class ModelGenerator < Base - argument :attributes, :type => :array, :default => [], :banner => "field:type field:type" - - check_class_collision - - class_option :migration, :type => :boolean - class_option :timestamps, :type => :boolean - class_option :parent, :type => :string, :desc => "The parent class for the generated model" - - def create_migration_file - return unless options[:migration] && options[:parent].nil? - migration_template "migration.rb", "db/migrate/create_#{table_name}.rb" - end - - def create_model_file - template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb") - end - - hook_for :test_framework - - protected - - def parent_class_name - options[:parent] || "ActiveRecord::Base" - end - - end - end -end diff --git a/railties/lib/generators/active_record/model/templates/migration.rb b/railties/lib/generators/active_record/model/templates/migration.rb deleted file mode 100644 index 1f68487304..0000000000 --- a/railties/lib/generators/active_record/model/templates/migration.rb +++ /dev/null @@ -1,16 +0,0 @@ -class <%= migration_class_name %> < ActiveRecord::Migration - def self.up - create_table :<%= table_name %> do |t| -<% for attribute in attributes -%> - t.<%= attribute.type %> :<%= attribute.name %> -<% end -%> -<% if options[:timestamps] %> - t.timestamps -<% end -%> - end - end - - def self.down - drop_table :<%= table_name %> - end -end diff --git a/railties/lib/generators/active_record/model/templates/model.rb b/railties/lib/generators/active_record/model/templates/model.rb deleted file mode 100644 index 21ae29e9f2..0000000000 --- a/railties/lib/generators/active_record/model/templates/model.rb +++ /dev/null @@ -1,5 +0,0 @@ -class <%= class_name %> < <%= parent_class_name.classify %> -<% attributes.select {|attr| attr.reference? }.each do |attribute| -%> - belongs_to :<%= attribute.name %> -<% end -%> -end |