aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/scoping/default_scoping_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* asakusa.rb hack night!Aaron Patterson + Akira Matsuda2013-08-061-0/+2
| | | | Fix in-memory tests
* Revert change on ActiveRecord::Relation#order method that prepends newRafael Mendonça França2013-07-291-4/+4
| | | | | | | | | | | | | | | order on the old ones The previous behavior added a major backward incompatibility since it impossible to have a upgrade path without major changes on the application code. We are taking the most conservative path to be consistent with the idea of having a smoother upgrade on Rails 4. We are reverting the behavior for what was in Rails 3.x and, if needed, we will implement a new API to prepend the order clauses in Rails 4.1.
* close our connection when we are doneAaron Patterson2013-07-081-1/+6
|
* Simplify/fix implementation of default scopesJon Leighton2013-06-281-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous implementation was necessary in order to support stuff like: class Post < ActiveRecord::Base default_scope where(published: true) scope :ordered, order("created_at") end If we didn't evaluate the default scope at the last possible moment before sending the SQL to the database, it would become impossible to do: Post.unscoped.ordered This is because the default scope would already be bound up in the "ordered" scope, and therefore wouldn't be removed by the "Post.unscoped" part. In 4.0, we have deprecated all "eager" forms of scopes. So now you must write: class Post < ActiveRecord::Base default_scope { where(published: true) } scope :ordered, -> { order("created_at") } end This prevents the default scope getting bound up inside the "ordered" scope, which means we can now have a simpler/better/more natural implementation of default scoping. A knock on effect is that some things that didn't work properly now do. For example it was previously impossible to use #except to remove a part of the default scope, since the default scope was evaluated after the call to #except.
* Delegate #unscope query methodCarlos Antonio da Silva2013-04-281-0/+10
|
* split relation_scoping_test.rb's default scoping tests into another fileTakehiro Adachi2013-03-301-0/+360