aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/finder_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Tidy up the AR tests, removing duplicates and making tests clearer / more ↵Josh Sharpe2009-08-081-46/+11
| | | | | | | | focussed. Signed-off-by: Michael Koziarski <michael@koziarski.com> [#2774 state:committed]
* Some databases (e.g. Oracle) does not allow "AS" between table name and ↵Raimonds Simanovskis2009-08-061-1/+1
| | | | table alias name, for others it is optional
* Extract generic attribute method generation to AMoJoshua Peek2009-08-041-1/+1
|
* quoted_date converts time-like objects to ↵Geoff Buesing2009-08-031-0/+50
| | | | ActiveRecord::Base.default_timezone before serialization. This allows you to use Time.now in find conditions and have it correctly be serialized as the current time in UTC when default_timezone == :utc [#2946 state:resolved]
* Revert "Revert "Generate proper :counter_sql from :finder_sql when there is ↵Pratik Naik2009-07-011-2/+2
| | | | | | | | | a newline character immediately following 'SELECT' [#2118 state:resolved]"" This reverts commit 80f1f863cd0f9cba89079511282de5710a2e1832. The feature doesn't work on Postgres, so don't test it on Postgres. Also, Postgres compatibility is irrelevant to the ticket/patch in question.
* Revert "Generate proper :counter_sql from :finder_sql when there is a ↵Yehuda Katz + Carl Lerche2009-06-221-2/+2
| | | | | | | | newline character immediately following 'SELECT' [#2118 state:resolved]" This reverts commit 4851ca9e13a4317342df02ae25b1929340523f7a. The tests do not pass for postgresql.
* Generate proper :counter_sql from :finder_sql when there is a newline ↵Patrick Joyce2009-06-211-2/+2
| | | | | | character immediately following 'SELECT' [#2118 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Add missing model and fixtures to finder_test [#2671 state:resolved]Emilio Tagua2009-05-181-2/+2
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Changed ActiveRecord::Base#exists? to invoke find_initial so that it is ↵Peter Marklund2009-05-141-0/+6
| | | | | | | compatible with, and doesn't lose, :include scopes (references to eager loaded tables) Signed-off-by: Michael Koziarski <michael@koziarski.com> [#2543 state:committed]
* Cherry-pick core extensionsJeremy Kemper2009-05-131-2/+3
|
* Fix models load order to be able to run unit tests.Emilio Tagua2009-04-231-4/+4
| | | | | | [#2550 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Ruby 1.9 compat: rename deprecated assert_raises to assert_raise.Jeremy Kemper2009-03-081-32/+32
| | | | [#1617 state:resolved]
* Allow :having conditions to be sanitized like regular :condition. [#2158 ↵Will Bryant2009-03-061-0/+7
| | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Ensure supplie :from has precedence over scoped :from [#1370 state:resolved]Pratik Naik2009-03-061-0/+8
|
* support end-exclusive ... Ranges in SQL hash condition sanitization properlyWill Bryant2009-02-061-0/+6
| | | | | Signed-off-by: Michael Koziarski <michael@koziarski.com> [#1865 state:committed]
* Add ActiveRecord::Base.exists? with no args [#1817 state:committed]Scott Taylor2009-02-051-1/+10
| | | | Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
* Bump mocha requirement for Ruby 1.9 compat. Remove uses_mocha.Jeremy Kemper2009-02-031-12/+10
|
* Add :having option to find, to use in combination with grouped finds. Also ↵miloops2008-12-011-0/+7
| | | | | | | added to has_many and has_and_belongs_to_many associations. Signed-off-by: Michael Koziarski <michael@koziarski.com> [#1028 state:committed]
* Fixed issue where block is not called on the very first invocation of a ↵Ken Miller2008-10-241-0/+11
| | | | | | find_or_create_by_ automatic finder. [#1224 state:committed]
* Dynamic finders should use the ActiveRecord::Base::find method instead of ↵Eloy Duran2008-10-031-5/+22
| | | | | | | | | | | | ::find_initial, :find_last, and ::find_all. This is so when people override ActiveRecord::Base::find, the new ::find method will also be invoked by the dynamic finders. Associations for instance do go through ::find, so this makes it more consistent. Also removed the unnecessary deprecation silence blocks. Signed-off-by: Michael Koziarski <michael@koziarski.com> [#1162 state:committed]
* Allowed passing arrays-of-strings to :join everywhere. Merge duplicate join ↵Pivotal Labs2008-09-241-0/+11
| | | | | | | strings to avoid table aliasing problems. Signed-off-by: Michael Koziarski <michael@koziarski.com> [#1077 state:committed]
* Change all calls to String#chars to String#mb_chars.Manfred Stienstra2008-09-211-2/+2
|
* Use select and change test so new tests can work on postgres.miloops2008-09-121-2/+2
| | | | Signed-off-by: Michael Koziarski <michael@koziarski.com>
* Improve test coverage when using the group option in find, has_many or ↵miloops2008-09-111-0/+6
| | | | | | has_and_belongs_to_many. Signed-off-by: Michael Koziarski <michael@koziarski.com>
* Fix ActiveRecord::Base.quote_bound_value for ActiveSupper::Multibyte::Chars ↵Manfred Stienstra2008-09-111-2/+10
| | | | | | | | | | values. - Adds String#acts_like_string? - Adds Chars#acts_like_string? Signed-off-by: Michael Koziarski <michael@koziarski.com> [#1029 state:committed]
* Fixed test_find_last_by_one_attribute_caches_dynamic_finder for postgresql 8.3Tarmo Tänav2008-09-101-1/+1
| | | | Signed-off-by: Michael Koziarski <michael@koziarski.com>
* Added find_last_by dynamic finder [status:committed #762]miloops2008-09-091-4/+36
| | | | Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
* add dynamic finder bang version to raise RecordNotFoundJosh Susser2008-08-251-0/+14
| | | | | | [#905 state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* refactor dynamic finder name matching into its own classJosh Susser2008-08-251-0/+42
| | | | Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Allow conditions on multiple tables to be specified using hash.Pratik Naik2008-06-281-0/+17
| | | | | | | | | Examples: User.all :joins => :items, :conditions => { :age => 10, :items => { :color => 'black' } } Item.first :conditions => { :items => { :color => 'red' } } Note : Hash key in :conditions is referring to the actual table name or the alias defined in query.
* Named bind variables can now be used with postgresql-style typecastsTarmo Tänav2008-06-221-0/+7
| | | | | For example :conditions => ['stringcol::integer = :var', { :var => 10 }] will no longer raise an exception about ':integer' having a missing value.
* Fix tests for postgres 8.3.xTarmo Tänav2008-05-261-1/+1
| | | | | | | | | Made test_with_limiting_with_custom_select not dependent on database default order. Fixed tests with non-US monetary locale. The monetary type is fixed precision so it should not expect the database to return a float. Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* DRY associations code and improve eager loading tests.Pratik Naik2008-05-151-1/+4
|
* Make sure needed table joins are included :select option. [#110 state:resolved]John Devine2008-05-151-3/+6
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Added logic to associations.rb to make sure select_for_limited_idsJohn Devine2008-05-061-0/+9
| | | | | | | | | includes joins that are needed to reach tables listed in the :order or :conditions options if they are not joined directly to the main active_record table. Signed-off-by: Michael Koziarski <michael@koziarski.com> [#109 state:resolved]
* Ensure that respond_to? considers dynamic finder methods. Closes #11538. ↵Pratik Naik2008-04-061-11/+11
| | | | | | [floehopper] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9235 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed that ActiveRecord#Base.find_or_create/initialize would not honor ↵David Heinemeier Hansson2008-03-251-0/+32
| | | | | | attr_protected/accessible when used with a hash (closes #11422) [miloops] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9090 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added ActiveRecord#Base.all/first/last as aliases for ↵David Heinemeier Hansson2008-03-241-0/+8
| | | | | | find(:all/:first/:last) (closes #11413) [nkallen, thechrisoshow] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9085 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Merge the has_finder gem, renamed as 'named_scope'. Closes #11404 [nkallen]Rick Olson2008-03-241-4/+4
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9084 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix edge case with colons in times interpreted as bind variables by ↵Jeremy Kemper2008-02-271-0/+2
| | | | | | requiring that bind vars start with a letter. Closes #10519 [matrix9180] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8936 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Merge branch 'ar-test-cleanup' of git://git.geeksomnia.com/railsJeremy Kemper2008-01-211-2/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8681 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Support aggregations in finder conditions. Closes #10572.Jeremy Kemper2008-01-191-1/+177
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8671 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix pathsJeremy Kemper2008-01-181-8/+8
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8661 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Move tests to casesJeremy Kemper2008-01-181-0/+650
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8660 5ecf4fe2-1ee6-0310-87b1-e25e094e27de