aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/rails
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2013-05-19 21:40:12 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2013-05-19 21:40:12 +0530
commitd71b0935a956ebedea0bb975525fc0f5672e4088 (patch)
treeea512e13fd13dd144bdbf3469514beb8fba010c6 /activerecord/lib/rails
parentd3d8cfd5689188f48714f49ad000a1c1fbd9edcd (diff)
parent7f24d3d6956a7775771302d143e3b09de681d12f (diff)
downloadrails-d71b0935a956ebedea0bb975525fc0f5672e4088.tar.gz
rails-d71b0935a956ebedea0bb975525fc0f5672e4088.tar.bz2
rails-d71b0935a956ebedea0bb975525fc0f5672e4088.zip
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'activerecord/lib/rails')
-rw-r--r--activerecord/lib/rails/generators/active_record/model/model_generator.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/rails/generators/active_record/model/model_generator.rb b/activerecord/lib/rails/generators/active_record/model/model_generator.rb
index 40e134e626..7e8d68ce69 100644
--- a/activerecord/lib/rails/generators/active_record/model/model_generator.rb
+++ b/activerecord/lib/rails/generators/active_record/model/model_generator.rb
@@ -12,6 +12,9 @@ module ActiveRecord
class_option :parent, :type => :string, :desc => "The parent class for the generated model"
class_option :indexes, :type => :boolean, :default => true, :desc => "Add indexes for references and belongs_to columns"
+
+ # 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
@@ -39,6 +42,7 @@ module ActiveRecord
protected
+ # Used by the migration template to determine the parent name of the model
def parent_class_name
options[:parent] || "ActiveRecord::Base"
end