aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/querying.rb
Commit message (Collapse)AuthorAgeFilesLines
* Remove old deprecation warningSean Griffin2014-06-221-8/+1
| | | | | This has been around for a couple of versions now, a `NoMethodError` should suffice at this point.
* No need to decorate columns twiceSean Griffin2014-06-101-1/+1
| | | | | | | We never want result types to override column types, and `decorate_columns` can only affect column types. No need to go through the decoration multiple times, we can just exclude the column types from the result types instead.
* Result sets never override a model's column typeSean Griffin2014-05-291-1/+1
| | | | | | | | | | | | MySQL and PostgreSQL provide a column type override in order to properly type cast computed columns included in a result set. This should never override the known types of full fledged columns. In addition to messing up computed properties, this would have led to inconsistent behavior between a record created with `new`, and a record created with `last` on the mysql adapter in the following cases: - `tinyint(1)` with `emulate_booleans` set to `false` - `text`, `string`, `binary`, and `decimal` columns
* Ensure #second acts like #first AR finderJason Meller2014-01-201-0/+1
| | | | | | | | | | | | This commit bring the famous ordinal Array instance methods defined in ActiveSupport into ActiveRecord as fully-fledged finders. These finders ensure a default ascending order of the table's primary key, and utilize the OFFSET SQL verb to locate the user's desired record. If an offset is defined in the query, calling #second adds to the offset to get the actual desired record. Fixes #13743.
* Delegate #rewhere to all on the class like all other relation methodsDavid Heinemeier Hansson2013-11-021-1/+1
|
* Moving the `pluck` and `ids` methods to their own delegate line.wangjohn2013-06-251-8/+9
| | | | | | | | These two methods aren't really statistical helper methods and don't really belong in any other group which is being delegated for querying, so I'm moving them to their own group of methods. I've also changed the `:to => :all` hash syntax to `to: :all`.
* improved doc for ActiveRecord#find_by_sql method (Refs #10599) [ci skip]Anton Kalyaev2013-05-141-3/+4
|
* Delegate #unscope query methodCarlos Antonio da Silva2013-04-281-1/+1
|
* rename `Relation#uniq` to `Relation#distinct`. `#uniq` still works.Yves Senn2013-03-151-1/+1
| | | | | | | | 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 AR auto-explain (config.auto_explain_threshold_in_seconds)Yves Senn2013-02-241-14/+10
| | | | | | | | | | 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.
* Refactor to use each_key, remove extra spacesCarlos Antonio da Silva2013-01-281-1/+0
|
* Cleans and removes 'Examples' tag [ci skip]Alvaro Pereyra2012-12-011-5/+2
|
* Add Relation#find_or_create_by and friendsJon Leighton2012-10-191-0/+1
| | | | | | | This is similar to #first_or_create, but slightly different and a nicer API. See the CHANGELOG/docs in the commit. Fixes #7853
* Remove ActiveRecord::Base.to_aJon Leighton2012-08-031-1/+1
| | | | | On reflection, it seems like a bit of a weird method to have on ActiveRecord::Base, and it shouldn't be needed most of the time anyway.
* load active_support/deprecation in active_support/railsXavier Noria2012-08-021-1/+0
|
* load active_support/core_ext/module/delegation in active_support/railsXavier Noria2012-08-021-1/+0
|
* ActiveRecord::Base.all returns a Relation.Jon Leighton2012-07-271-7/+7
| | | | | | | | | | | Previously it returned an Array. If you want an array, call e.g. `Post.to_a` rather than `Post.all`. This is more explicit. In most cases this should not break existing code, since Relations use method_missing to delegate unknown methods to #to_a anyway.
* Log query plan when we use count_by_sql method.kennyj2012-07-181-2/+4
|
* Introducing `take` as a replacement to the old behavior of `first`Marcelo Silveira2012-05-021-1/+1
|
* Fix PR #6091Andrew White2012-04-301-1/+1
| | | | | | 1. ActiveRecord::Base is not ActiveRecord::Relation 2. The order of records from an SQL query is uncertain without an ORDER clause 3. Run your own tests when submitting a pull request
* Add Relation#find_by and Relation#find_by!Jon Leighton2012-03-301-0/+1
|
* column types are passed from the result set to the instantiated AR objectAaron Patterson2012-02-071-1/+10
|
* Merge pull request #4805 from xuanxu/none_and_null_object_patternJon Leighton2012-01-311-1/+1
|\ | | | | Added `none` query method to return zero records.
| * Added `none` query method to return zero records.Juanjo Bazán2012-01-311-1/+1
| | | | | | And added NullRelation class implementing the null object pattern for the `Relation` class.
* | always return the result set from select_allAaron Patterson2012-01-311-1/+1
| |
* | made the result set object act more like an arrayAaron Patterson2012-01-311-1/+2
|/
* Add ActiveRecord::Relation#references (#950)Jon Leighton2012-01-161-1/+1
|
* Split out most of the AR::Base code into separate modules :cake:Jon Leighton2011-12-151-0/+58