Class

AssociationCollection

Extends:

There's no documentation for this item.

Public Methods
<< Add records to this association. Returns self so method calls may be chained. Since << flattens its argument list and inserts each record, push and concat behave identically.
any?
clear Removes all records from this association. Returns self so method calls may be chained.
concat Alias for #<<
create
create!
delete Remove records from this association. Does not destroy records.
delete_all Remove all records from this association
destroy_all
empty?
length Returns the size of the collection by loading it and calling size on the array. If you want to use this method to check whether the collection is empty, use collection.length.zero? instead of collection.empty?
push Alias for #<<
replace Replace this collection with other_array This will perform a diff and delete/add only records that have changed.
reset
size Returns the size of the collection by executing a SELECT COUNT(*) query if the collection hasn’t been loaded and calling collection.size if it has. If it’s more likely than not that the collection does have a size larger than zero and you need to fetch that collection afterwards, it’ll take one less SELECT query if you use length.
sum Calculate sum using SQL, not Enumerable
to_ary
uniq
Protected Methods
construct_scope overloaded in derived Association classes to provide useful scoping depending on association type.
find_target
method_missing
reset_target!
Private Methods
add_record_to_target_with_callbacks
build_record
callback
callbacks_for
create_record
ensure_owner_is_not_new
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.