0
@@ -690,6 +690,7 @@ module ActiveRecord
0
# association is a polymorphic +belongs_to+.
0
# * <tt>:uniq</tt> - If true, duplicates will be omitted from the collection. Useful in conjunction with <tt>:through</tt>.
0
# * <tt>:readonly</tt> - If true, all the associated objects are readonly through the association.
0
+ # * <tt>:validate</tt> - If false, don't validate the associated objects when saving the parent object. true by default.
0
# has_many :comments, :order => "posted_on"
0
@@ -710,7 +711,7 @@ module ActiveRecord
0
configure_dependency_for_has_many(reflection)
0
- add_multiple_associated_save_callbacks(reflection.name)
0
+ add_multiple_associated_save_callbacks(reflection.name)
unless options[:validate] == false0
add_association_callbacks(reflection.name, reflection.options)
0
@@ -769,6 +770,7 @@ module ActiveRecord
0
# * <tt>:source_type</tt> - Specifies type of the source association used by <tt>has_one :through</tt> queries where the source
0
# association is a polymorphic +belongs_to+.
0
# * <tt>:readonly</tt> - If true, the associated object is readonly through the association.
0
+ # * <tt>:validate</tt> - If false, don't validate the associated object when saving the parent object. +false+ by default.
0
# has_one :credit_card, :dependent => :destroy # destroys the associated credit card
0
@@ -799,7 +801,7 @@ module ActiveRecord
0
- add_single_associated_save_callbacks(reflection.name)
0
+ add_single_associated_save_callbacks(reflection.name)
if options[:validate] == true0
association_accessor_methods(reflection, HasOneAssociation)
0
association_constructor_method(:build, reflection, HasOneAssociation)
0
association_constructor_method(:create, reflection, HasOneAssociation)
0
@@ -857,6 +859,7 @@ module ActiveRecord
0
# Note: If you've enabled the counter cache, then you may want to add the counter cache attribute
0
# to the +attr_readonly+ list in the associated classes (e.g. <tt>class Post; attr_readonly :comments_count; end</tt>).
0
# * <tt>:readonly</tt> - If true, the associated object is readonly through the association.
0
+ # * <tt>:validate</tt> - If false, don't validate the associated objects when saving the parent object. +true+ by default.
0
# belongs_to :firm, :foreign_key => "client_of"
0
@@ -937,6 +940,8 @@ module ActiveRecord
0
+ add_single_associated_save_callbacks(reflection.name) unless options[:validate] == false
0
configure_dependency_for_belongs_to(reflection)
0
@@ -1025,6 +1030,7 @@ module ActiveRecord
0
# * <tt>:select</tt> - By default, this is <tt>*</tt> as in <tt>SELECT * FROM</tt>, but can be changed if, for example, you want to do a join
0
# but not include the joined columns. Do not forget to include the primary and foreign keys, otherwise it will raise an error.
0
# * <tt>:readonly</tt> - If true, all the associated objects are readonly through the association.
0
+ # * <tt>:validate</tt> - If false, don't validate the associated objects when saving the parent object. +true+ by default.
0
# has_and_belongs_to_many :projects
0
@@ -1037,7 +1043,7 @@ module ActiveRecord
0
def has_and_belongs_to_many(association_id, options = {}, &extension)
0
reflection = create_has_and_belongs_to_many_reflection(association_id, options, &extension)
0
- add_multiple_associated_save_callbacks(reflection.name)
0
+ add_multiple_associated_save_callbacks(reflection.name)
unless options[:validate] == false0
collection_accessor_methods(reflection, HasAndBelongsToManyAssociation)
0
# Don't use a before_destroy callback since users' before_destroy
0
@@ -1343,7 +1349,8 @@ module ActiveRecord
0
:finder_sql, :counter_sql,
0
:before_add, :after_add, :before_remove, :after_remove,
0
options[:extend] = create_extension_modules(association_id, extension, options[:extend])
0
@@ -1353,7 +1360,7 @@ module ActiveRecord
0
def create_has_one_reflection(association_id, options)
0
options.assert_valid_keys(
0
- :class_name, :foreign_key, :remote, :select, :conditions, :order, :include, :dependent, :counter_cache, :extend, :as, :readonly
0
+ :class_name, :foreign_key, :remote, :select, :conditions, :order, :include, :dependent, :counter_cache, :extend, :as, :readonly
, :validate0
create_reflection(:has_one, association_id, options, self)
0
@@ -1361,7 +1368,7 @@ module ActiveRecord
0
def create_has_one_through_reflection(association_id, options)
0
options.assert_valid_keys(
0
- :class_name, :foreign_key, :remote, :select, :conditions, :order, :include, :dependent, :counter_cache, :extend, :as, :through, :source, :source_type
0
+ :class_name, :foreign_key, :remote, :select, :conditions, :order, :include, :dependent, :counter_cache, :extend, :as, :through, :source, :source_type
, :validate0
create_reflection(:has_one, association_id, options, self)
0
@@ -1369,7 +1376,7 @@ module ActiveRecord
0
def create_belongs_to_reflection(association_id, options)
0
options.assert_valid_keys(
0
:class_name, :foreign_key, :foreign_type, :remote, :select, :conditions, :include, :dependent,
0
- :counter_cache, :extend, :polymorphic, :readonly
0
+ :counter_cache, :extend, :polymorphic, :readonly
, :validate0
reflection = create_reflection(:belongs_to, association_id, options, self)
0
@@ -1388,7 +1395,8 @@ module ActiveRecord
0
:finder_sql, :delete_sql, :insert_sql,
0
:before_add, :after_add, :before_remove, :after_remove,
0
options[:extend] = create_extension_modules(association_id, extension, options[:extend])
Comments
No one has commented yet.