aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/finder_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Improve performance and functionality of the postgresql adapter. Closes ↵Michael Koziarski2007-08-161-7/+9
| | | | | | #8049 [roderickvd] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7329 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Change the implementation of ActiveRecord's attribute reader and writer methods:Michael Koziarski2007-08-141-2/+3
| | | | | | | | | | | * Generate Reader and Writer methods which cache attribute values in hashes. This is to avoid repeatedly parsing the same date or integer columns. * Move the attribute related methods out to attribute_methods.rb to de-clutter base.rb * Change exception raised when users use find with :select then try to access a skipped column. Plugins could override missing_attribute() to lazily load the columns. * Move method definition to the class, instead of the instance * Always generate the readers, writers and predicate methods. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7315 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Move from select * to select tablename.* to avoid clobbering IDs. Closes ↵Michael Koziarski2007-07-071-0/+9
| | | | | | #8889 [dasil003] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7167 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Array attribute conditions work with proxied association collections. Closes ↵Jeremy Kemper2007-06-271-1/+5
| | | | | | #8318. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7133 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Remove deprecated find_first and find_all.Jeremy Kemper2007-06-111-0/+8
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6998 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix an edge case with find with a list of ids, limit, and offset. Closes #8437.Jeremy Kemper2007-05-311-0/+7
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6912 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* find gracefully copes with blank :conditions. Closes #7599.Jeremy Kemper2007-05-261-0/+13
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6852 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Typo in [6845]. References #8437.Jeremy Kemper2007-05-251-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6846 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Find with a list of ids supports limit/offset. Closes #8437.Jeremy Kemper2007-05-251-46/+49
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6845 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Include some missing fixtures. Closes #7981.Jeremy Kemper2007-05-251-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6832 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* find_or_create_by_* takes a hash so you can create with more attributes than ↵Jeremy Kemper2007-03-141-0/+19
| | | | | | are in the method name. Closes #7368. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6420 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Post title and body not null. References #6778.Jeremy Kemper2007-01-281-1/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6067 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* MySQL: SET SQL_AUTO_IS_NULL=0 so 'where id is null' doesn't select the last ↵Jeremy Kemper2007-01-281-0/+6
| | | | | | inserted id. Closes #6778. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6064 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Pass a range in :conditions to use the SQL BETWEEN operator. Closes #6974.Jeremy Kemper2007-01-101-0/+10
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5876 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Ensure dynamic finders are anchored to the beginning of the method name to ↵Michael Koziarski2006-12-271-0/+7
| | | | | | prevent git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5795 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Support nil and Array in :conditions => { attr => value } hashes. Closes #6548.Jeremy Kemper2006-11-051-2/+14
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5435 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Deprecation: count class method should be called with an options hash rather ↵Jeremy Kemper2006-09-261-3/+3
| | | | | | than two args for conditions and joins. Closes #6287. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5192 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Backed out of new_record? to new? transformation as it would screw up ↵David Heinemeier Hansson2006-09-051-4/+4
| | | | | | existing models that did boolean calls on "new" attributes [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5018 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Deprecated ActiveRecord::Base.new_record? in favor of ↵David Heinemeier Hansson2006-09-051-4/+4
| | | | | | ActiveRecord::Base.new? (old version still works until Rails 2.0) [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5017 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* has_one supports the :dependent => :delete option which skips the typical ↵Jeremy Kemper2006-08-291-2/+2
| | | | | | callback chain and deletes the associated object directly from the database. Closes #5927. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4848 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Clashing type columns due to a sloppy join shouldn't wreck single-table ↵Jeremy Kemper2006-08-241-0/+5
| | | | | | inheritance. Closes #5838. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4813 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* The exists? class method should treat a string argument as an id rather than ↵Jeremy Kemper2006-08-031-7/+8
| | | | | | as conditions. Closes #5698. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4655 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added support for conditions on Base.exists? (closes #5689) [josh@joshpeek.com]David Heinemeier Hansson2006-08-031-0/+3
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4651 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Rollback [4584], bad test. Reopens #3819.Jeremy Kemper2006-07-081-14/+1
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4586 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Don't modify options parameters in-place. Closes #3819.Jeremy Kemper2006-07-081-1/+14
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4584 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added find_or_initialize_by_X which works like find_or_create_by_X but ↵Sam Stephenson2006-06-201-0/+15
| | | | | | doesn't save the newly instantiated record git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4473 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added simple hash conditions to find that'll just convert hash to an ↵David Heinemeier Hansson2006-06-031-2/+31
| | | | | | AND-based condition string (closes #5143) [hcatlin@gmail.com] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4425 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Mind the order of things.Jeremy Kemper2006-06-011-7/+3
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4393 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Records and arrays of records are bound as quoted ids.Jeremy Kemper2006-06-011-0/+33
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4391 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Add support for FrontBase (http://www.frontbase.com/) with a new adapter ↵Marcel Molina2006-04-271-0/+6
| | | | | | thanks to the hard work of one Mike Laster. Closes #4093. [mlaster@metavillage.com] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4291 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* SQL Server adapter gets some love (closes #4298) [rtomayko@gmail.com]David Heinemeier Hansson2006-03-181-0/+5
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3949 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* fix test_find_in_association_with_options test, tweak other tests affected ↵Rick Olson2006-03-161-1/+1
| | | | | | by developer/project addition git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3890 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed eager loading problems with single-table inheritance [Rick Olson] ↵David Heinemeier Hansson2006-03-051-1/+2
| | | | | | Added smarter table aliasing for eager associations for multiple self joins [Rick Olson] (closes #3580) git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3776 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* test_find_or_create_from_two_attributes is a duplicate of ↵David Heinemeier Hansson2006-02-191-4/+4
| | | | | | test_find_or_create_from_one_attribute (closes #3863) [jp.bougie@gmail.com] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3617 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Add explicit :order in finder tests as postgresql orders results differently ↵Marcel Molina2006-01-221-1/+1
| | | | | | by default. Closes #3577. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3464 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Make dynamic finders honor additional passed in :conditions. Closes #3569.Marcel Molina2006-01-221-1/+14
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3463 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Don't raise an exception when there are more keys than there are named bind ↵Marcel Molina2006-01-051-16/+0
| | | | | | variables when sanitizing conditions. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3382 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* r3095@asus: jeremy | 2005-11-15 22:40:51 -0800Jeremy Kemper2005-11-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Ticket #1874 - Firebird adapter r3107@asus: jeremy | 2005-11-16 00:06:14 -0800 quote column aliases r3108@asus: jeremy | 2005-11-16 00:08:12 -0800 quote columns in construct_conditions_from_arguments. update sequence_name docs. introduce prefetched primary keys. r3109@asus: jeremy | 2005-11-16 00:09:08 -0800 double-quote rather than single-quote sqlite columns r3110@asus: jeremy | 2005-11-16 00:09:56 -0800 quote column names and use attribute_condition in validates_uniqueness_of r3111@asus: jeremy | 2005-11-16 00:12:24 -0800 Use QUOTED_TYPE constant in tests r3112@asus: jeremy | 2005-11-16 00:13:28 -0800 restrict test_inserts_with_pre_and_suffix to those adapters which support migrations r3113@asus: jeremy | 2005-11-16 00:14:09 -0800 Use QUOTED_TYPE constant in tests r3114@asus: jeremy | 2005-11-16 00:14:30 -0800 Use QUOTED_TYPE constant in tests git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3051 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Correct handling of complex order clauses with SQL Server limit emulation. ↵Jeremy Kemper2005-11-081-0/+10
| | | | | | Closes #2770. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2943 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added extension capabilities to has_many and has_and_belongs_to_many proxies ↵David Heinemeier Hansson2005-11-041-0/+14
| | | | | | [DHH] Added find_or_create_by_X as a second type of dynamic finder that'll create the record if it doesn't already exist [DHH] Added constrain scoping for creates using a hash of attributes bound to the :creation key [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2872 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed SQL Server adapter so it honors options[:conditions] when applying ↵David Heinemeier Hansson2005-10-281-0/+6
| | | | | | :limits (closes #1978) [Tom Ward] Fixed SQL Server adapter to pass even more tests and do even better (closes #2634) [rtomayko@gmail.com] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2781 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fixed handling of nil number columns on Oracle and cleaned up tests for ↵David Heinemeier Hansson2005-10-261-12/+6
| | | | | | Oracle in general #2555 [schoenm@earthlink.net] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2741 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added quoted_true and quoted_false methods to db2_adapter and cleaned up ↵David Heinemeier Hansson2005-10-261-1/+1
| | | | | | tests for DB2 (closes #2493) [maik schmidt] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2739 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* r2718@asus: jeremy | 2005-10-23 14:45:30 -0700Jeremy Kemper2005-10-231-1/+1
| | | | | | | | | | | Ticket 2404 - fixture delete order r2719@asus: jeremy | 2005-10-23 15:01:13 -0700 Keep closer tabs on dirty, loaded, and declared fixtures. Closes #2404. r2720@asus: jeremy | 2005-10-23 16:09:19 -0700 ensure table names are strings. set dirty = dirty union loaded rather than dirty = loaded. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2714 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Clarify semantics of ActiveRecord::Base#respond_to? Closes #2560.Jeremy Kemper2005-10-221-1/+7
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2705 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* modified finder test a tiny bit so that it passes on sqlserverTobias Lütke2005-10-161-2/+2
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2657 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Raise an exception when invalid options are passed to ↵Marcel Molina2005-10-061-0/+5
| | | | | | ActiveRecord::Base.find. Closes #2363. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2481 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Quote booleans according the rules defined by the adapterMichael Koziarski2005-10-061-2/+2
| | | | | | | | | | * SQLite schema has been updated * Postgresql schema needs to be fixed too Simplify AR::Base#toggle to store the boolean, not the quoted value * expand the tests git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2474 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Wrap :conditions in parentheses to prevent problems with OR's #1871Jamis Buck2005-09-241-1/+9
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2324 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added AbstractAdapter#select_value and AbstractAdapter#select_values as ↵David Heinemeier Hansson2005-09-241-0/+13
| | | | | | convenience methods for selecting single values, instead of hashes, of the first column in a SELECT #2283 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2323 5ecf4fe2-1ee6-0310-87b1-e25e094e27de