aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/rails/generators
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-05-21 11:02:15 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-05-21 11:02:15 -0700
commit68a97e81187358ae8a4d59499d9afc2f09d35d24 (patch)
tree93b9cd36021c746545de70d2f658b446fa71d910 /activerecord/lib/rails/generators
parenteb2bb7d56f1eefb96a99321b18ed7b4b7ef1d4d6 (diff)
parentac70ec64138765ddd2a7c5e0130243e6df98cf2d (diff)
downloadrails-68a97e81187358ae8a4d59499d9afc2f09d35d24.tar.gz
rails-68a97e81187358ae8a4d59499d9afc2f09d35d24.tar.bz2
rails-68a97e81187358ae8a4d59499d9afc2f09d35d24.zip
Merge branch 'master' into experiment
* master: (49 commits) avoid creating a set if no where values are removed remove bind values for where clauses that were removed push partitioning up so bind elimination can get the removed wheres push partion logic down and initialization logic up the rake task `db:test:prepare` needs to load the configuration In batches test @total was assigned but not used. Use it in tests instead of Post.count partition the where values so we can access the removed ones eliminate some conditionals change method name to reflect what it actually does. save the where values in variables so we don't need to look them up all the time pass where values to the helper function rather than rely on internal state Spelling correction in Upgrading Guide Add has_named_route? to the mapper API No need CHANGELOG entry for a test fix Fix wrong `case_sensitive` in uniqueness validity test Fix typo in test name and documentation Missing ending ``` at 14.2 Merging of scopes copy edits[ci skip] Revert "Corrected documentation and added some more for the classify method in inflectors" Revert "Changed the CHANGELOG for active_support and improved the doc for inflector method classify" ...
Diffstat (limited to 'activerecord/lib/rails/generators')
-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