aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/finder_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Reverting 16f6f25 (Change behaviour with empty array in where clause)Guillermo Iguaran2013-02-081-0/+9
|
* Change behaviour with empty array in where clauserobertomiranda2013-02-081-9/+0
|
* CVE-2012-5664 options hashes should only be extracted if there are extra ↵Aaron Patterson2013-01-021-0/+12
| | | | | | | parameters Conflicts: activerecord/lib/active_record/dynamic_matchers.rb
* Assert the query result instead of checking for nothing raisedCarlos Antonio da Silva2012-11-131-4/+2
| | | | | | | Nothing should be raised anyway :smile: Thanks @spastorino :heart: https://github.com/rails/rails/pull/8202/files#r2112067
* Regression test for #7238Nikita Afanasenko2012-11-131-0/+7
|
* Raise MissingAttributeError on query methodsErnie Miller2012-09-081-0/+1
| | | | | | | | | | | | | When calling a query method on an attribute that was not selected by an ActiveRecord query, an ActiveModel::MissingAttributeError is not raised. Instead, a nil value is returned, which will return false once cast to boolean. This is undesirable, as we should not give the impression that we know the attribute's boolean value when we haven't loaded the attribute's (possibly) non-boolean value from the database. This issue is present on versions going back as far as 2.3, at least.
* 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.
* Revert "Removing composed_of from ActiveRecord."Rafael Mendonça França2012-07-271-0/+99
| | | | | | | | | | | This reverts commit 14fc8b34521f8354a17e50cd11fa3f809e423592. Reason: we need to discuss a better path from this removal. Conflicts: activerecord/lib/active_record/reflection.rb activerecord/test/cases/base_test.rb activerecord/test/models/developer.rb
* Deprecate ActiveRecord::Base.scoped.Jon Leighton2012-07-271-69/+69
| | | | | | | It doesn't serve much purpose now that ActiveRecord::Base.all returns a Relation. The code is moved to active_record_deprecated_finders.
* ActiveRecord::Base.all returns a Relation.Jon Leighton2012-07-271-17/+17
| | | | | | | | | | | 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.
* exists?(false) returns falseEgor Lynko2012-06-251-0/+4
| | | | `FinderMethods#exists?` finder method now returns *false* with the *false* argument
* made dynamic finders alias_attribute awareMaximilian Schneider2012-06-221-0/+5
| | | | | previously dynamic finders only worked in combination with the actual column name and not its alias defined with #alias_attribute
* Removing composed_of from ActiveRecord.Steve Klabnik2012-06-181-99/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This feature adds a lot of complication to ActiveRecord for dubious value. Let's talk about what it does currently: class Customer < ActiveRecord::Base composed_of :balance, :class_name => "Money", :mapping => %w(balance amount) end Instead, you can do something like this: def balance @balance ||= Money.new(value, currency) end def balance=(balance) self[:value] = balance.value self[:currency] = balance.currency @balance = balance end Since that's fairly easy code to write, and doesn't need anything extra from the framework, if you use composed_of today, you'll have to add accessors/mutators like that. Closes #1436 Closes #2084 Closes #3807
* Address ORA-00911 errors because of the heading underscore.Yasuo Honda2012-06-111-1/+1
|
* Fix that #exists? raises ThrowResult when called with an empty limitedBen Woosley2012-06-101-1/+6
| | | | | | | | | reflection. ActiveRecord::FinderMethods#construct_limited_ids_condition will raise ThrowResult if the limited reflection comes back empty. The other callers of #construct_limited_ids_condition handle this exception (more specifically, the callers of construct_relation_for*), but #exists? didn't until now.
* Add test to column alias in `exists?` SQL.Rafael Mendonça França2012-06-101-0/+6
| | | | | | | | This behavior was added in be4ecdcc87984e9421ff5d5c90d33f475e0fbc01. Closes #1139. Fixes #2553, #1141, #1623 and #2062.
* stop `to_s`ing method namesAkira Matsuda2012-06-061-1/+1
| | | | Module#methods are Symbols in Ruby >= 1.9
* quarantine more deprecated stuffJon Leighton2012-05-181-9/+0
|
* quarantine deprecated testsJon Leighton2012-05-181-333/+2
|
* Return false for exists? with new records - fixes #6199.Andrew White2012-05-101-0/+1
|
* Use `take` instead of `first` to avoid unwanted implicit ordering (fixes #6147)Marcelo Silveira2012-05-051-0/+4
|
* Introducing `take` as a replacement to the old behavior of `first`Marcelo Silveira2012-05-021-2/+24
|
* Made `first` finder consistent among database engines by adding aMarcelo Silveira2012-05-021-0/+6
| | | | default order clause (fixes #5103)
* remove deprecated callsJon Leighton2012-04-271-22/+21
|
* more deprecations manually fixedJon Leighton2012-04-271-20/+15
|
* find and replace deprecated keysJon Leighton2012-04-271-46/+46
|
* %s/find(:\(first\|last\|all\), \([^()]*\))/scoped(\2).\1/gcI amongst other ↵Jon Leighton2012-04-271-130/+53
| | | | things
* remove calls to find(:first), find(:last) and find(:all)Jon Leighton2012-04-261-1/+1
|
* remove deprecate #all usageJon Leighton2012-04-261-1/+1
|
* remove deprecate #calculate callsJon Leighton2012-04-261-6/+0
|
* fix #scoped deprecationsJon Leighton2012-04-261-5/+5
|
* remove tests for #with_scope (it's now deprecated)Jon Leighton2012-04-251-14/+0
|
* fix testsJon Leighton2012-04-131-2/+2
|
* Add dynamic find_or_create_by_{attribute}! method.Andrew White2012-03-121-0/+22
|
* fix activerecord query_method regression with offset into FixnumDenis Jean2012-03-121-0/+4
| | | | | | add test to show offset query_methods on mysql & mysql2 change test to cover public API
* Fix regression from Rails 3.1Paul McMahon2012-01-271-0/+11
| | | | | | Under Rails 3.1, you were allowed to pass a hash to a find_or_create method with multiple attribute names, but this was broken as the arguments were being improperly validated.
* Deprecate inferred JOINs with includes + SQL snippets.Jon Leighton2012-01-161-3/+6
| | | | | | See the CHANGELOG for details. Fixes #950.
* Revert "Deprecate implicit eager loading. Closes #950."Jon Leighton2012-01-161-3/+3
| | | | This reverts commit c99d507fccca2e9e4d12e49b4387e007c5481ae9.
* Deprecate implicit eager loading. Closes #950.Jon Leighton2011-12-291-3/+3
|
* Deprecate set_primary_key in favour of self.primary_key=Jon Leighton2011-11-291-1/+1
|
* Fixes issue #3483, regarding using a mixture of ranges and discrete values ↵Ryan Naughton2011-11-141-1/+1
| | | | in find conditions. Paired with Joey Schoblaska.
* Failing test case for issue #3483Gabriel Sobrinho2011-11-141-0/+4
|
* exclude ORDER BY clause when querying Relation#exists?Akira Matsuda2011-11-091-0/+5
|
* Add ROWNUM to test first and last to support Oracle.Yasuo Honda2011-09-071-2/+2
|
* Merge pull request #2485 from akaspick/exists_fixJon Leighton2011-09-071-0/+9
|\ | | | | fix exists? to return false if passed nil (which may come from a missing
| * fix exists? to return false if passed nil (which may come from a missing URL ↵Andrew Kaspick2011-08-101-0/+9
| | | | | | | | param)
* | Use LIMIT sql word in last when it's possibleDamien Mathieu2011-09-051-1/+18
| |
* | use LIMIT SQL word in first - Closes #2783Damien Mathieu2011-09-051-0/+9
|/
* Raise an ArgumentError if user passing less number of argument in the ↵Prem Sichanugrist2011-07-171-0/+8
| | | | | | | | | | | | | dynamic finder The previous behavior was unintentional, and some people was relying on it. Now the dynamic finder will always expecting the number of arguments to be equal or greater (so you can still pass the options to it.) So if you were doing this and expecting the second argument to be nil: User.find_by_username_and_group("sikachu") You'll now get `ArgumentError: wrong number of arguments (1 for 2).` You'll then have to do this: User.find_by_username_and_group("sikachu", nil)
* formatsAkira Matsuda2011-07-091-5/+5
|