- 04 7月, 2013 1 次提交
-
-
由 Arun Agrawal 提交于
Removed tests from deprecated code.
-
- 02 7月, 2013 1 次提交
-
-
由 Neeraj Singh 提交于
Calling default_scope without a proc will now raise `ArgumentError`.
-
- 29 6月, 2013 1 次提交
-
-
由 Yves Senn 提交于
-
- 05 4月, 2013 2 次提交
-
-
由 Jon Leighton 提交于
See #9869 and #9929. The problem arises from the following example: class Project < ActiveRecord::Base scope :completed, -> { where completed: true } end class MajorProject < Project end When calling: MajorProject.where(tasks_count: 10).completed This expands to: MajorProject.where(tasks_count: 10).scoping { MajorProject.completed } However the lambda for the `completed` scope is defined on Project. This means that when it is called, `self` is Project rather than MajorProject. So it expands to: MajorProject.where(tasks_count: 10).scoping { Project.where(completed: true) } Since the scoping was applied on MajorProject, and not Project, this fails to apply the tasks_count condition. The solution is to make scoping apply across STI classes. I am slightly concerned about the possible side-effects of this, but no tests fail and it seems ok. I guess we'll see.
-
由 Neeraj Singh 提交于
-
- 30 3月, 2013 2 次提交
-
-
由 Takehiro Adachi 提交于
The file name should be name_scoping_test.rb and the class should be `NamedScopingTest` according to ActiveRecord::Scoping::Name
-
由 Takehiro Adachi 提交于
The scoping/default.rb and scoping/named.rb got moved under scoping/ in commit 2b22564c, but the tests never did.
-
- 28 3月, 2013 1 次提交
-
-
由 Rafael Mendonça França 提交于
-
- 19 3月, 2013 1 次提交
-
-
由 Krzysztof Jurewicz 提交于
-
- 08 3月, 2013 2 次提交
-
-
由 Carlos Antonio da Silva 提交于
Introduced in f1082b85. Full changelog in 9f007d7f. [ci skip]
-
Currently Post.active.inactive will result in Post.inactive since the last where clause wins when scopes are merged. This pull request will merge all scopes ( barring defaul scope) using AND. The default scope will be overridden if another scope acts on the same where clause. closes #7365
-
- 03 8月, 2012 1 次提交
-
-
由 Jon Leighton 提交于
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.
-
- 28 7月, 2012 1 次提交
-
-
由 Jon Leighton 提交于
It doesn't serve much purpose now that ActiveRecord::Base.all returns a Relation. The code is moved to active_record_deprecated_finders.
-
- 27 7月, 2012 1 次提交
-
-
由 Jon Leighton 提交于
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.
-
- 10 6月, 2012 2 次提交
-
-
由 kennyj 提交于
-
由 Steve Jorgensen 提交于
Several tests that passed when run in the order they are loaded by rake test were failing when run in different sequences due to problems with the implementation of assert_queries and assert_no_queries as well as incorrect assumptions made about how many queries might be executed by a database adapter in various cases.
-
- 18 5月, 2012 1 次提交
-
-
由 Jon Leighton 提交于
-
- 04 5月, 2012 3 次提交
-
-
由 Jon Leighton 提交于
-
由 Jon Leighton 提交于
-
由 Jon Leighton 提交于
-
- 27 4月, 2012 6 次提交
-
-
由 Jon Leighton 提交于
-
由 Jon Leighton 提交于
-
由 Jon Leighton 提交于
-
由 Jon Leighton 提交于
-
由 Jon Leighton 提交于
-
由 Jon Leighton 提交于
-
- 26 4月, 2012 3 次提交
-
-
由 Jon Leighton 提交于
-
由 Jon Leighton 提交于
-
由 Jon Leighton 提交于
-
- 25 4月, 2012 2 次提交
-
-
由 Jon Leighton 提交于
-
由 Jon Leighton 提交于
-
- 22 3月, 2012 2 次提交
-
-
由 Jon Leighton 提交于
Don't use this: scope :red, where(color: 'red') default_scope where(color: 'red') Use this: scope :red, -> { where(color: 'red') } default_scope { where(color: 'red') } The former has numerous issues. It is a common newbie gotcha to do the following: scope :recent, where(published_at: Time.now - 2.weeks) Or a more subtle variant: scope :recent, -> { where(published_at: Time.now - 2.weeks) } scope :recent_red, recent.where(color: 'red') Eager scopes are also very complex to implement within Active Record, and there are still bugs. For example, the following does not do what you expect: scope :remove_conditions, except(:where) where(...).remove_conditions # => still has conditions
-
由 Jon Leighton 提交于
scope is syntactic sugar for defining a class method. Ruby allows redefining methods but emits a warning when run with -w. So let's not implement our own logic for this. Users should run with -w if they want to be warned about redefined methods.
-
- 12 2月, 2012 1 次提交
-
-
由 Vishnu Atrai 提交于
This reverts commit 7381596e.
-
- 11 2月, 2012 1 次提交
-
-
由 Karunakar (Ruby) 提交于
-
- 22 12月, 2011 1 次提交
-
-
由 lest 提交于
-
- 17 12月, 2011 1 次提交
-
-
由 Sergey Nartimov 提交于
-
- 06 9月, 2011 2 次提交
-
-
由 Damien Mathieu 提交于
-
由 Damien Mathieu 提交于
-
- 18 7月, 2011 1 次提交
-
-
由 Prem Sichanugrist 提交于
-