aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation.rb
Commit message (Collapse)AuthorAgeFilesLines
* `implicit_readonly` is being removed in favor of calling `readonly` explicitlyYves Senn2013-05-271-5/+1
|
* cleanup whitespace in `active_record/relation.rb`.Yves Senn2013-05-271-4/+4
|
* include bind values from the default scopeAaron Patterson2013-05-171-2/+4
|
* Move #proxy_association method to AssociationRelationJon Leighton2013-05-101-1/+1
|
* Added :nodoc: for private methodsNoemj2013-04-301-3/+3
|
* Moved update_record logic to relation.rbNoemj2013-04-301-11/+25
|
* Refactor CollectionProxy#scope to avoid calling #extend.James Golick2013-04-021-1/+1
|
* :uniq is still a valid relation option since it was only silentlyRafael Mendonça França2013-04-011-1/+1
| | | | | | | | deprecated Fixes activerecord-deprecated_finders build. https://travis-ci.org/rails/activerecord-deprecated_finders/builds/5964703
* entirelyby => 'entirely by'Neeraj Singh2013-03-271-1/+1
|
* Fixed typos in activerecordPrathamesh Sonpatki2013-03-271-1/+1
|
* make it possible to disable implicit join references.Yves Senn2013-03-151-2/+6
| | | | Closes #9712.
* rename `Relation#uniq` to `Relation#distinct`. `#uniq` still works.Yves Senn2013-03-151-1/+7
| | | | | | | | The similarity of `Relation#uniq` to `Array#uniq` is confusing. Since our Relation API is close to SQL terms I renamed `#uniq` to `#distinct`. There is no deprecation. `#uniq` and `#uniq!` are aliases and will continue to work. I also updated the documentation to promote the use of `#distinct`.
* Remove unused return value, because collecting_queries_for_explain isn't ↵kennyj2013-03-061-2/+1
| | | | public API.
* fix the sql that is generated from scopingNeeraj Singh2013-03-031-1/+2
|
* remove AR auto-explain (config.auto_explain_threshold_in_seconds)Yves Senn2013-02-241-11/+1
| | | | | | | | | | We discussed that the auto explain feature is rarely used. This PR removes only the automatic explain. You can still display the explain output for any given relation using `ActiveRecord::Relation#explain`. As a side-effect this should also fix the connection problem during asset compilation (#9385). The auto explain initializer in the `ActiveRecord::Railtie` forced a connection.
* Improve relation docs about to_sql and where_values_hashCarlos Antonio da Silva2013-01-191-4/+4
| | | | | | | | * User class instead of Users. * #where_values_hash does not change the value to downcase as the example was showing. [ci skip]
* Fix .update_all and .delete_all when using a condition on a joined tableDerek Kraan2013-01-111-2/+2
| | | | | | | | | in a default_scope. `Model.joins(...).where(condition_on_joined_table).update_all` / `delete_all` worked, but the same operation implemented with a default_scope generated a SQL error because ActiveRecord ignored the join but implemented the where condition anyways.
* Rename update_attributes method to update, keep update_attributes as an aliasAmparo Luna + Guillermo Iguaran2013-01-031-1/+1
|
* Remove observers and sweepersRafael Mendonça França2012-11-281-6/+3
| | | | | | | | They was extracted from a plugin. See https://github.com/rails/rails-observers [Rafael Mendonça França + Steve Klabnik]
* Move initialize_copy method around to let new method / build alias closerCarlos Antonio da Silva2012-11-241-8/+8
|
* 1.9 Syntax related changesAvnerCohen2012-11-101-1/+1
|
* Another batch of hash syntax changes to comment, this time around, I tried ↵AvnerCohen2012-10-231-5/+5
| | | | to keep 'output' messages untouched.
* nodoc the first_or_create methods and document alternativesJon Leighton2012-10-191-37/+18
|
* Add Relation#find_or_create_by and friendsJon Leighton2012-10-191-0/+26
| | | | | | | This is similar to #first_or_create, but slightly different and a nicer API. See the CHANGELOG/docs in the commit. Fixes #7853
* Move two hotspots to use Hash[] rather than Hash#dupAaron Patterson2012-10-151-3/+5
| | | | https://bugs.ruby-lang.org/issues/7166
* Remove mass_assignment_options from ActiveRecordGuillermo Iguaran2012-09-161-6/+6
|
* Merge pull request #6606 from amatsuda/ar_relation_model_methodRafael Mendonça França2012-08-211-0/+1
|\ | | | | AR::Relation#model would be a better API than AR::Relation#klass
| * AR::Relation#model would be a better API than AR::Relation#klassAkira Matsuda2012-06-031-0/+1
| |
* | Merge pull request #7133 from roshats/fix_update_all_with_blank_argumentCarlos Antonio da Silva2012-08-151-1/+3
|\ \ | | | | | | | | | Change Relation#update_all with blank argument to raise an ArgumentError instead of trying an update with empty fields.
| * | raise ArgumentError if list of attributes to change is empty in update_allRoman Shatsov2012-08-141-1/+3
| | |
* | | load active_support/deprecation in active_support/railsXavier Noria2012-08-021-1/+0
| | |
* | | load active_support/core_ext/object/blank in active_support/railsXavier Noria2012-08-021-1/+0
| | |
* | | Refactor a bitJon Leighton2012-08-011-38/+37
| | | | | | | | | | | | | | | This doesn't change the exernal behavior, but it moves some code around to where I think it properly belongs.
* | | Add `Relation#load`Jon Leighton2012-08-011-2/+12
|/ / | | | | | | | | | | | | | | | | | | | | | | | | This method explicitly loads the records and then returns `self`. Rather than deciding between "do I want an array or a relation?", most people are actually asking themselves "do I want to eager load or lazy load?" Therefore, this method provides a way to explicitly eager-load without having to switch from a `Relation` to an array. Example: @posts = Post.where(published: true).load
* | minor copy edits [ci skip]Vijay Dev2012-07-211-3/+1
| |
* | Fix typosOscar Del Ben2012-07-191-3/+3
| |
* | Fix typos and add nodocs to NullRelationOscar Del Ben2012-07-171-3/+3
| |
* | Improve docs for AR RelationOscar Del Ben2012-07-171-7/+19
| |
* | Add docs for Relation initialize, create and create!Oscar Del Ben2012-07-161-1/+34
| |
* | Don't link to edgeguides in docsOscar Del Ben2012-07-161-1/+1
| |
* | Load all records in Relation#inspectJon Leighton2012-07-071-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A test was failing due to the way that Relation#inspect causes association proxies to ignore unsaved records added to the association. This is fixed by simply calling to_a and letting to_a figure out how to get the records (which, in the case of associations, takes into account new records). I think it is acceptable to do this rather than limiting the query at the database level: * It's what we've done in all released Rails versions up to this point * The goal of the limit is to not flood the console with output - this is the problem we're targeting, rather than the actual loading of the records from the database * You probably want to do something with those records later anyway, otherwise you wouldn't have built a relation for them.
* | Relation#inspect handles doesn't perform a new query on an already-loaded ↵Jon Leighton2012-07-071-1/+4
| | | | | | | | relation
* | Simplify Relation#inspectJon Leighton2012-07-071-12/+3
| |
* | Limit the number of records in Relation#inspectDamien Mathieu2012-07-061-1/+13
| | | | | | | | While it's interesting to have the results array, it can make a console or a webpage freeze if there are a lot of them. So this limits the number of records displayed in #inspect to 10 and tells how much were effectively found.
* | Show the records in Relation#inspectJon Leighton2012-07-061-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reason for removing the previous implementation of `#inspect` was that it hid from you that you were dealing with a `Relation` rather than an `Array`. But it is still useful to be able to see the records, particularly if you're writing something like the following in tests: assert_equal [foo], Post.where(:bar) If the assertion fails, you want to see what records were actually loaded. So this implementation makes it clear that you've got a `Relation`, but also shows your records.
* | Remove ActiveRelation#inspectBrian Cardarella2012-06-291-4/+0
| |
* | Refactor Relation#update a bit to avoid an extra Enumerator instanceCarlos Antonio da Silva2012-06-181-1/+1
|/
* add explanation of raising errors when a limit scope is supplied in ↵Francesco Rodriguez2012-05-181-11/+11
| | | | Relation#delete_all
* delete_all raise an error if a limit is provided - fixes #4979Francesco Rodriguez2012-04-301-0/+2
|
* extract #with_scope and #with_exclusive_scope to ↵Jon Leighton2012-04-251-1/+4
| | | | active_record_deprecated_finders