aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/project.rb
Commit message (Collapse)AuthorAgeFilesLines
* Deprecate eager-evaluated scopes.Jon Leighton2012-03-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add interpolation of association conditions back in, in the form of proc { ↵Jon Leighton2011-02-141-8/+9
| | | | ... } rather than instance_eval-ing strings
* Let AssociationCollection#find use #scoped to do its finding. Note that I am ↵Jon Leighton2011-01-031-0/+4
| | | | removing test_polymorphic_has_many_going_through_join_model_with_disabled_include, since this specifies different behaviour for an association than for a regular scope. It seems reasonable to expect scopes and association proxies to behave in roughly the same way rather than having subtle differences.
* Refactor new callbacks and AR implementation.José Valim2009-09-081-1/+2
| | | | Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Revert "Revert "Generate proper :counter_sql from :finder_sql when there is ↵Pratik Naik2009-07-011-0/+6
| | | | | | | | | a newline character immediately following 'SELECT' [#2118 state:resolved]"" This reverts commit 80f1f863cd0f9cba89079511282de5710a2e1832. The feature doesn't work on Postgres, so don't test it on Postgres. Also, Postgres compatibility is irrelevant to the ticket/patch in question.
* Revert "Generate proper :counter_sql from :finder_sql when there is a ↵Yehuda Katz + Carl Lerche2009-06-221-6/+0
| | | | | | | | newline character immediately following 'SELECT' [#2118 state:resolved]" This reverts commit 4851ca9e13a4317342df02ae25b1929340523f7a. The tests do not pass for postgresql.
* Generate proper :counter_sql from :finder_sql when there is a newline ↵Patrick Joyce2009-06-211-0/+6
| | | | | | character immediately following 'SELECT' [#2118 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Fix tests for sqlite3 3.6.xxPratik Naik2009-04-211-1/+1
|
* Add :having option to find, to use in combination with grouped finds. Also ↵miloops2008-12-011-0/+1
| | | | | | | added to has_many and has_and_belongs_to_many associations. Signed-off-by: Michael Koziarski <michael@koziarski.com> [#1028 state:committed]
* Fixed ordering in ↵Tarmo Tänav2008-08-221-1/+1
| | | | test_find_in_association_with_custom_finder_sql_and_multiple_interpolations
* Introduce the :readonly option to all associations. Records from the ↵Jeremy Kemper2008-02-131-0/+1
| | | | | | association cannot be saved. Closes #11084. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8864 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* move assets and modelsJeremy Kemper2008-01-181-0/+28
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8657 5ecf4fe2-1ee6-0310-87b1-e25e094e27de