mirror of
https://github.com/github/rails.git
synced 2026-02-10 06:04:55 -05:00
Merge with docrails. Also add a rake task to generate guides in your rails application :
rake doc:guides The rake task will generate guides inside doc/guides directory of your application. Open index.html to browse.
This commit is contained in:
@@ -624,7 +624,8 @@ module ActiveRecord
|
||||
# Adds one or more objects to the collection by setting their foreign keys to the collection's primary key.
|
||||
# [collection.delete(object, ...)]
|
||||
# Removes one or more objects from the collection by setting their foreign keys to +NULL+.
|
||||
# This will also destroy the objects if they're declared as +belongs_to+ and dependent on this model.
|
||||
# Objects will be in addition destroyed if they're associated with <tt>:dependent => :destroy</tt>,
|
||||
# and deleted if they're associated with <tt>:dependent => :delete_all</tt>.
|
||||
# [collection=objects]
|
||||
# Replaces the collections content by deleting and adding objects as appropriate.
|
||||
# [collection_singular_ids]
|
||||
|
||||
@@ -183,7 +183,13 @@ module ActiveRecord
|
||||
end
|
||||
|
||||
|
||||
# Remove +records+ from this association. Does not destroy +records+.
|
||||
# Removes +records+ from this association calling +before_remove+ and
|
||||
# +after_remove+ callbacks.
|
||||
#
|
||||
# This method is abstract in the sense that +delete_records+ has to be
|
||||
# provided by descendants. Note this method does not imply the records
|
||||
# are actually removed from the database, that depends precisely on
|
||||
# +delete_records+. They are in any case removed from the collection.
|
||||
def delete(*records)
|
||||
records = flatten_deeper(records)
|
||||
records.each { |record| raise_on_type_mismatch(record) }
|
||||
|
||||
@@ -61,6 +61,7 @@ module ActiveRecord
|
||||
record.save
|
||||
end
|
||||
|
||||
# Deletes the records according to the <tt>:dependent</tt> option.
|
||||
def delete_records(records)
|
||||
case @reflection.options[:dependent]
|
||||
when :destroy
|
||||
|
||||
Reference in New Issue
Block a user