aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/collection_proxy.rb
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #25941 from kamipo/finder_methods_uses_load_targetRafael França2016-07-281-1/+1
|\ | | | | `FinderMethods` uses `records` (`load_target`) when `loaded?` is true
| * `FinderMethods` uses `records` (`load_target`) when `loaded?` is trueRyuta Kamizono2016-07-281-1/+1
| |
* | Fix to `CollectionProxy#load` does `load_target`Ryuta Kamizono2016-07-251-0/+6
|/
* Add `exists?` and `update_all` to `CollectionProxy` for respects an ↵Ryuta Kamizono2016-07-201-5/+1
| | | | | | association scope Fixes #25732.
* [ci skip] fix a typoYamaguchi.Tomoki2016-07-151-1/+1
|
* Support for unified Integer class in Ruby 2.4+Jeremy Daer2016-05-181-2/+2
| | | | | | | | Ruby 2.4 unifies Fixnum and Bignum into Integer: https://bugs.ruby-lang.org/issues/12005 * Forward compat with new unified Integer class in Ruby 2.4+. * Backward compat with separate Fixnum/Bignum in Ruby 2.2 & 2.3. * Drops needless Fixnum distinction in docs, preferring Integer.
* Forward ActiveRecord::Relation#count to Enumerable#count if block givenErik Michaels-Ober2016-03-191-3/+9
|
* Mutating the result of Relation#to_a should not affect the relationMatthew Draper2016-02-211-0/+4
| | | | | | Clarifying this separation and enforcing relation immutability is the culmination of the previous efforts to remove the mutator method delegations.
* rename to 'second_to_last' and 'third_to_last'Brian Christian2016-02-101-4/+4
|
* allow Array.penultimate and Array.antepenultiate access methodsBrian Christian2016-02-091-0/+10
|
* applies new doc guidelines to Active Record.Yves Senn2015-10-141-9/+9
| | | | | | | | | | | | | | | | | | | The focus of this change is to make the API more accessible. References to method and classes should be linked to make it easy to navigate around. This patch makes exzessiv use of `rdoc-ref:` to provide more readable docs. This makes it possible to document `ActiveRecord::Base#save` even though the method is within a separate module `ActiveRecord::Persistence`. The goal here is to bring the API closer to the actual code that you would write. This commit only deals with Active Record. The other gems will be updated accordingly but in different commits. The pass through Active Record is not completely finished yet. A follow up commit will change the spots I haven't yet had the time to update. /cc @fxn
* fix broken RDoc markup. Use `<tt>` instead of `+`. [ci skip]Yves Senn2015-10-141-3/+3
|
* Fix `ActiveRecord::RecordNotFound` error message with custom primary key [ci ↵amitkumarsuroliya2015-09-261-7/+7
| | | | skip]
* Added nodoc for `arel` method which returns object of private api. [ci skip]Ronak Jangir2015-09-091-1/+1
|
* Added docs for CollectionProxy#take [ci skip]Ronak Jangir2015-08-231-0/+25
|
* Add missing method name to exception descriptionMehmet Emin İNAÇ2015-07-201-1/+1
|
* [ci skip] Fix typo in #any? RDocAndrii Ponomarov2015-07-171-1/+1
|
* [ci skip] fix the `collection.clear` guideRoque Pinel2015-06-021-7/+8
| | | | | | | | | | | Improve the guide about `has_many` `collection.clear` to indicate the behavior for each dependent strategy according to `collection.delete_all`. Based on #17179, I changed the `collection.delete` docs to also clarify the default strategy for each `hm` and `hm:t` associations. Fixes #20170.
* Updated documentation of CollectionProxy#clear [ci skip]Prathamesh Sonpatki2015-03-061-0/+3
| | | | | | | | - CollectionProxy#clear method calls delete_all so the SQL is directly run into the database. - So the updated_at column of the object on which its run is not updated. - Closes #17161
* Preserve Array#take(n) behaviour of HasManyAssociationAkira Matsuda2015-02-281-2/+2
|
* Merge branch 'rm-take' into 4-1-stableRafael Mendonça França2015-02-201-0/+4
|
* Remove support to activerecord-deprecated_findersRafael Mendonça França2015-01-021-4/+2
|
* Ensure `first!` and friends work on loaded associationsSean Griffin2014-12-291-0/+1
| | | | Fixes #18237
* Inject the `PredicateBuilder` into the `Relation` instanceSean Griffin2014-12-261-1/+1
| | | | | | | Construction of relations can be a hotspot, we don't want to create one of these in the constructor. This also allows us to do more expensive things in the predicate builder's constructor, since it's created once per AR::Base subclass
* [ci skip] Clarify deletion strategies for collection proxieseileencodes2014-10-041-17/+14
| | | | | | | | | | | For detailed testing of behavior see: https://gist.github.com/eileencodes/5b0a2fe011dcff6203fe This shows destroy_all always destroys records and fires callbacks. It will never use nullify or delete_all delete_all's behavior varies greatly based on `hm` vs `hm:t` and deletion strategy.
* [ci skip] Updated documentation syntax of other parameter for rdocTom Kadwill2014-08-271-1/+1
|
* Merge pull request #16705 from tomkadwill/documented_many_block_paramZachary Scott2014-08-261-1/+1
|\ | | | | [ci skip] Updated documentation syntax of block parameter for rdoc
| * [ci skip] Updated documentation syntax of block parameter for rdoc Tom Kadwill2014-08-261-1/+1
| |
* | [ci skip] Updated include to reference record parameter for rdocTom Kadwill2014-08-261-1/+1
|/
* [ci skip] Updated documentation syntax of block parameter for rdocTom Kadwill2014-08-261-1/+1
|
* fix CollectionProxy delete_all documentationeileencodes2014-04-061-6/+1
| | | | | | | This method no longer returns an array of all records that have been removed. Correct documentation to reflect this change. See issue 14546
* CollectionProxy uses the arel of its association's scope.Jefferson Lai2014-04-021-0/+4
| | | | | | CollectionProxy should be able to reuse the behavior (methods) of its parent class, but with its own state. This change allows CollectionProxy to use the arel object corresponding to its association's scope.
* Make CollectionProxy#reset return selfRafael Mendonça França2014-01-221-1/+2
|
* Calling reset on a collection association should unload the assocationKelsey Schlarman2014-01-211-0/+21
| | | | Need to define #reset on CollectionProxy.
* Ensure AR #second, #third, etc. finders work through associationsJason Meller2014-01-211-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit fixes two regressions introduced in cafe31a078 where newly created finder methods #second, #third, #forth, and #fifth caused a NoMethodError error on reload associations and where we were pulling the wrong element out of cached associations. Examples: some_book.authors.reload.second # Before # => NoMethodError: undefined method 'first' for nil:NilClass # After # => #<Author id: 2, name: "Sally Second", ...> some_book.first.authors.first some_book.first.authors.second # Before # => #<Author id: 1, name: "Freddy First", ...> # => #<Author id: 1, name: "Freddy First", ...> # After # => #<Author id: 1, name: "Freddy First", ...> # => #<Author id: 2, name: "Sally Second", ...> Fixes #13783.
* add missing information for `id` field when used with `select` [ci skip]Kuldeep Aggarwal2014-01-221-1/+1
|
* Change all "can not"s to the correct "cannot".T.J. Schuck2014-01-031-1/+1
|
* Merge pull request #10134 from ↵Rafael Mendonça França2014-01-031-3/+3
|\ | | | | | | | | derikson/collection_proxy_select_with_multiple_args Change CollectionProxy#select to take the same arguments as ActiveRecord::select
| * Changed ActiveRecord::Associations::CollectionProxy#select to take multiple ↵Dan Erikson2013-04-081-3/+3
| | | | | | | | | | | | arguments. This makes the arguments the same as ActiveRecord::QueryMethods::select.
* | Mark the arguments needed by activerecord-deprecated_finders with a TODORafael Mendonça França2013-12-111-0/+2
| |
* | Revert "Merge pull request #12518 from vipulnsward/remove_count_options"Rafael Mendonça França2013-12-111-2/+2
| | | | | | | | | | | | | | It is needed for activerecord-depecated_finders This reverts commit dcff027a5242b20c0c90eb062dddb22ccf51aed9, reversing changes made to 3a2093984ff49d86db1efeff0c7581e788ecfb9f.
* | Change syntax format for example returned valuesPrem Sichanugrist2013-11-111-4/+4
| | | | | | | | | | | | | | | | | | According to our guideline, we leave 1 space between `#` and `=>`, so we want `# =>` instead of `#=>`. Thanks to @fxn for the suggestion. [ci skip]
* | Fix typo: `has_many :pets`, not `pets :has_many`.Peter Jaros2013-10-241-1/+1
| |
* | `Relation#count` doesn't use options anymore.Vipul A M2013-10-131-2/+2
| |
* | Stray nodoc causes rest of file not parsed [ci skip]edogawaconan2013-08-221-2/+0
| |
* | Removed support for deprecated `counter_sql`Neeraj Singh2013-07-021-1/+1
| |
* | Do not invoke callbacks when delete_all is calledNeeraj Singh2013-06-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | Method `delete_all` should not be invoking callbacks and this feature was deprecated in Rails 4.0. This is being removed. `delete_all` will continue to honor the `:dependent` option. However if `:dependent` value is `:destroy` then the default deletion strategy for that collection will be applied. User can also force a deletion strategy by passing parameter to `delete_all`. For example you can do `@post.comments.delete_all(:nullify)`
* | Simplify/fix implementation of default scopesJon Leighton2013-06-281-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous implementation was necessary in order to support stuff like: class Post < ActiveRecord::Base default_scope where(published: true) scope :ordered, order("created_at") end If we didn't evaluate the default scope at the last possible moment before sending the SQL to the database, it would become impossible to do: Post.unscoped.ordered This is because the default scope would already be bound up in the "ordered" scope, and therefore wouldn't be removed by the "Post.unscoped" part. In 4.0, we have deprecated all "eager" forms of scopes. So now you must write: class Post < ActiveRecord::Base default_scope { where(published: true) } scope :ordered, -> { order("created_at") } end This prevents the default scope getting bound up inside the "ordered" scope, which means we can now have a simpler/better/more natural implementation of default scoping. A knock on effect is that some things that didn't work properly now do. For example it was previously impossible to use #except to remove a part of the default scope, since the default scope was evaluated after the call to #except.
* | `CollectionProxy#include?` returns `true` and `false` as documented.Yves Senn2013-06-181-1/+1
| |
* | emphasize that callbacks are called in destroy_allNeeraj Singh2013-05-131-3/+3
| | | | | | | | | | | | | | Cleaned up rdoc a bit emphasizing that callbacks are called. Also removed the stress on the fact that records are always removed. If callbacks return false then records will not be deleted.