aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/method_scoping_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* stop calling to_sym when building arel nodes [CVE-2013-1854]Aaron Patterson2013-03-151-5/+5
|
* Make it the responsibility of the connection to hold onto an ARel visitor ↵Jon Leighton2011-08-081-4/+4
| | | | for generating SQL. This improves the code architecture generally, and solves some problems with marshalling. Adapter authors please take note: you now need to define an Adapter.visitor_for method, but it degrades gracefully with a deprecation warning for now.
* please use ruby -I lib:test path/to/test.rb, or export RUBY_OPTAaron Patterson2011-06-061-1/+1
|
* Refactor Active Record test connection setup. Please see the ↵Jon Leighton2011-06-041-1/+1
| | | | RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
* minor cleaning with new api methodVishnu Atrai2011-05-111-11/+11
|
* Deprecated support for passing hashes and relations to default_scope, in ↵Jon Leighton2011-04-121-6/+6
| | | | favour of defining a 'default_scope' class method in the model. See the CHANGELOG for more details.
* Remove Relation#& alias for Relation#mergeErnie Miller2011-02-121-1/+1
|
* stop calling deprecated apisAaron Patterson2010-12-261-4/+4
|
* adding tests for #5234 and #5184. Tests were from Akira Matsuda. Thanks Akira!Aaron Patterson2010-10-301-0/+6
|
* Set attributes properly for model built from association with conditions ↵Marcelo Giorgi2010-09-281-1/+1
| | | | | | [#5562 state:resolved] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* specific number of spaces should not be enforcedAaron Patterson2010-09-101-1/+1
|
* code gardening: we have assert_(nil|blank|present), more concise, with ↵Xavier Noria2010-08-171-1/+1
| | | | better default failure messages - let's use them
* do not rely on arel class structureAaron Patterson2010-08-061-0/+7
|
* removing unused models from testsSubba Rao Pasupuleti2010-07-211-2/+1
| | | | | | [#5153 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Add scoping and unscoped as the syntax to replace the old with_scope and ↵José Valim2010-06-291-202/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with_exclusive_scope. A few examples: * with_scope now should be scoping: Before: Comment.with_scope(:find => { :conditions => { :post_id => 1 } }) do Comment.first #=> SELECT * FROM comments WHERE post_id = 1 end After: Comment.where(:post_id => 1).scoping do Comment.first #=> SELECT * FROM comments WHERE post_id = 1 end * with_exclusive_scope now should be unscoped: class Post < ActiveRecord::Base default_scope :published => true end Post.all #=> SELECT * FROM posts WHERE published = true Before: Post.with_exclusive_scope do Post.all #=> SELECT * FROM posts end After: Post.unscoped do Post.all #=> SELECT * FROM posts end Notice you can also use unscoped without a block and it will return an anonymous scope with default_scope values: Post.unscoped.all #=> SELECT * FROM posts
* with_exclusive_scope does not work properly if ARel is passed. It does work ↵Neeraj Singh2010-06-291-0/+6
| | | | | | | | nicely if hash is passed. Blow up if user is attempting it pass ARel to with_exclusive_scope. [#3838 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Support for multiple selects addedNeeraj Singh and Santiago Pastorino2010-06-251-3/+5
| | | | [#4841 state:committed]
* Final iteration of use better testing methodsNeeraj Singh2010-05-191-1/+1
| | | | | | [#4652 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Remove Model.clear_default_scopePratik Naik2010-05-181-12/+0
|
* Modified default_scope to merge with any pre-existing default_scopeDavid Chelimsky + Brian Tatnall2010-05-151-2/+29
| | | | | | | | | | | | and added AR::Base::clear_default_scope - clear_default_scope provides users who rely on the old behaviour of each call to default_scope overwriting any previous default scopes an opportunity to maintain that behaviour. [#4583 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* cleaning up a bunch of parse time warnings in AR [#4186 state:resolved]Aaron Patterson2010-03-151-1/+1
| | | | Signed-off-by: wycats <wycats@gmail.com>
* Fix a bug where default_scope was overriding attributes given on model ↵Henry Hsu2010-02-261-0/+10
| | | | | | initialization [#3218 status:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Make default_scope work with RelationsPratik Naik2010-01-231-1/+7
|
* Remove Relation#where_clausePratik Naik2010-01-191-4/+4
|
* Get rid of Relation#order_clausesPratik Naik2010-01-181-3/+3
|
* Make merging of order values consistentPratik Naik2010-01-171-4/+4
|
* Make scopes use relations under the hoodPratik Naik2010-01-161-33/+32
|
* Don't publicize with_scope for tests since it may shadow public misuseJeremy Kemper2009-12-281-87/+87
|
* Moved relation's test to relation_test.Emilio Tagua2009-10-051-2/+2
|
* Merge commit 'rails/master'Emilio Tagua2009-08-081-0/+1
|\ | | | | | | | | | | Conflicts: activerecord/test/cases/adapter_test.rb activerecord/test/cases/method_scoping_test.rb
| * Oracle generates different ORDER BY fragmentRaimonds Simanovskis2009-08-061-1/+2
| |
* | Introduced ActiveRecord::Relation, a layer between an ARel relation and an ↵Emilio Tagua2009-07-211-2/+2
| | | | | | | | AR relation
* | Merge commit 'rails/master'Emilio Tagua2009-05-181-0/+10
|\| | | | | | | | | | | | | | | | | Conflicts: activerecord/lib/active_record.rb Updated: Arel submodule
| * Make sure default_scope#create checks for options[:conditions] [#2181 ↵Pratik Naik2009-05-181-0/+10
| | | | | | | | state:resolved] [James Le Cuirot]
* | Merge commit 'rails/master'Emilio Tagua2009-05-021-3/+3
|\|
| * Default scope :order should be overridden by named scopes.Alexander Podgorbunsky2009-05-011-3/+3
| | | | | | | | | | | | [#2346 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* | construct_finder_sql now use ArelEmilio Tagua2009-04-241-1/+1
|/
* Fix models load order to be able to run unit tests.Emilio Tagua2009-04-231-1/+1
| | | | | | [#2550 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Don't duplicate :order from scope and options, it makes mysql do extra workJeremy Kemper2009-03-101-2/+4
|
* Ensure nested with_scope merges conditions inside out [#2193 state:resolved]Manfred Stienstra2009-03-101-5/+33
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* update the default scope test to take the model's default scope into accountrick2009-02-251-1/+1
|
* Ensure whitespaces are stripped when merging string joins. [#1297 ↵Filip H.F. "FiXato" Slagter2009-01-281-0/+10
| | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Ensure Model#last doesn't affects order for another finders inside the same ↵Daniel Luz2008-12-211-0/+18
| | | | | | scope [#1499 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Fix default_scope to work in combination with named scopesTom Stuart2008-11-171-3/+9
| | | | Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
* Added default_scope to Base [#1381 state:committed] (Paweł Kondzior)Pratik Naik2008-11-161-0/+61
|
* Revert "Added default_scope to Base [#1381 state:committed] (Paweł ↵David Heinemeier Hansson2008-11-161-38/+0
| | | | | | Kondzior)" -- won't gel with threads. This reverts commit ff594b2bc94ff2a942fe6ca05672387722dee686.
* Added default_scope to Base [#1381 state:committed] (Paweł Kondzior)David Heinemeier Hansson2008-11-161-0/+38
|
* Allowed passing arrays-of-strings to :join everywhere. Merge duplicate join ↵Pivotal Labs2008-09-241-0/+30
| | | | | | | strings to avoid table aliasing problems. Signed-off-by: Michael Koziarski <michael@koziarski.com> [#1077 state:committed]
* Merge scoped :joins together instead of overwriting them. May expose scoping ↵Andrew White2008-08-281-2/+79
| | | | | | | | bugs in your code! [#501 state:resolved] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Added missing fixtures for tests which fail to run independently if run ↵Tarmo Tänav2008-08-041-1/+1
| | | | | | after schema reset Signed-off-by: Michael Koziarski <michael@koziarski.com>