aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/finder_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Return nil from read_attribute(:foo) if 'foo' is not present in the ↵Jon Leighton2011-04-151-1/+2
| | | | @attributes hash, but the _foo method has been defined. This brings the behaviour into line with the 3-0-stable branch and the master branch before 93641ed6c8c684f6b4db02b6c8a22fa9bc7f0eaf (there were previously no assertions about this which is why the change slipped through). Note that actually calling the 'foo' method will still raise an error if the attribute is not present.
* test against AR class rather than the relation (thanks Andrew White!)Aaron Patterson2011-03-291-2/+2
|
* order is not guaranteed by this select, so add an order and call first!Aaron Patterson2011-03-291-1/+1
|
* Delegate first!, last!, any? and many? to scopedAndrew White2011-03-291-0/+16
|
* Change exists? so that it doesn't instantiate records [#6127 state:resolved]Andrew White2011-03-291-0/+5
|
* add #first! and #last! to models & relationsJosh Susser2011-03-241-0/+24
|
* Merge branch 'master' into nested_has_many_throughJon Leighton2011-03-041-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/CHANGELOG activerecord/lib/active_record/association_preload.rb activerecord/lib/active_record/associations.rb activerecord/lib/active_record/associations/class_methods/join_dependency.rb activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb activerecord/lib/active_record/associations/has_many_association.rb activerecord/lib/active_record/associations/has_many_through_association.rb activerecord/lib/active_record/associations/has_one_association.rb activerecord/lib/active_record/associations/has_one_through_association.rb activerecord/lib/active_record/associations/through_association_scope.rb activerecord/lib/active_record/reflection.rb activerecord/test/cases/associations/has_many_through_associations_test.rb activerecord/test/cases/associations/has_one_through_associations_test.rb activerecord/test/cases/reflection_test.rb activerecord/test/cases/relations_test.rb activerecord/test/fixtures/memberships.yml activerecord/test/models/categorization.rb activerecord/test/models/category.rb activerecord/test/models/member.rb activerecord/test/models/reference.rb activerecord/test/models/tagging.rb
| * using arel to compile sql statementsAaron Patterson2010-12-251-1/+1
| |
* | Merge branch 'master' into nested_has_many_throughJon Leighton2010-11-171-22/+32
|\| | | | | | | | | | | Conflicts: activerecord/lib/active_record/associations/has_many_through_association.rb activerecord/test/cases/associations/has_many_through_associations_test.rb
| * removing many unused variablesAaron Patterson2010-11-161-1/+1
| |
| * Finder gives a little bit more info on the lookup column (primary key)Franck Verrot2010-11-131-0/+10
| |
| * use persisted? instead of new_record? wherever possibleDavid Chelimsky2010-11-091-21/+21
| | | | | | | | | | | | | | | | | | | | | | - persisted? is the API defined in ActiveModel - makes it easier for extension libraries to conform to ActiveModel APIs without concern for whether the extended object is specifically ActiveRecord [#5927 state:committed] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
| * Add some tests for functionality in JoinAssociation which already exists but ↵Jon Leighton2010-10-131-1/+1
| | | | | | | | was previously untested
* | Properly support conditions on any of the reflections involved in a nested ↵Jon Leighton2010-10-191-2/+4
| | | | | | | | through association
* | Refactoring JoinDependency and friends. This improves the code (IMO) ↵Jon Leighton2010-10-061-1/+1
| | | | | | | | including adding some explanatory comments, but more importantly structures it in such a way as to allow a JoinAssociation to produce an arbitrary number of actual joins, which will be necessary for nested has many through support. Also added 3 tests covering functionality which existed but was not previously covered.
* | Fix the tests (I have actually verified that these are also the 'right' ↵Jon Leighton2010-10-031-1/+1
|/ | | | fixes, rather than just making the tests pass again)
* fisting test organizationAaron Patterson2010-09-291-51/+0
|
* query value is converted to_s instead of to_yamlRainerBlessing2010-08-031-0/+8
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* removing unused models from testsSubba Rao Pasupuleti2010-07-211-1/+0
| | | | | | [#5153 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Final iteration of use better testing methodsNeeraj Singh2010-05-191-1/+1
| | | | | | [#4652 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Make use of assert_equal to test equallity between object assert expects and ↵Santiago Pastorino2010-05-161-2/+2
| | | | | | | | object and a message of error [#4611 state:committed] Signed-off-by: José Valim <jose.valim@gmail.com>
* Make find_or_create and find_or_initialize work mixing explicit parameters ↵Santiago Pastorino2010-05-071-1/+17
| | | | | | and a hash [#4457 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Remove quoted_string_prefix entirely since PostgreSQL was the only database ↵Jeremy Kemper2010-04-241-2/+2
| | | | adapter relying on it.
* Don't depend on order of elements in SetEvan Phoenix2010-03-221-5/+16
|
* Don't publicize with_scope for tests since it may shadow public misuseJeremy Kemper2009-12-281-2/+2
|
* Add Model.from and association_collection#from finder methodsPratik Naik2009-12-281-1/+1
|
* Make Model.find_or_create_by_* and find_or_initialize_by_* use relations and ↵Pratik Naik2009-12-271-7/+0
| | | | remove method caching
* Make Model.find_by_* and Model.find_all_by_* use relations and remove ↵Pratik Naik2009-12-271-46/+0
| | | | dynamic method caching
* Replace Model.first(options) with new finder methods inside testsPratik Naik2009-12-271-2/+2
|
* Ensure Model.scoped adds type conditions for STI modelsPratik Naik2009-12-271-1/+1
|
* Merge commit 'rails/master'Emilio Tagua2009-08-081-47/+12
|\ | | | | | | | | | | Conflicts: activerecord/test/cases/adapter_test.rb activerecord/test/cases/method_scoping_test.rb
| * 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
* | Merge commit 'rails/master'Emilio Tagua2009-08-051-1/+51
|\|
| * 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]
* | Introduced ActiveRecord::Relation, a layer between an ARel relation and an ↵Emilio Tagua2009-07-211-2/+2
|/ | | | AR relation
* 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
|