Commit Graph

30 Commits

Author SHA1 Message Date
Jon Leighton
34609d67b4 Deprecate set_inheritance_column in favour of self.inheritance_column= 2011-11-29 20:13:36 +00:00
Aaron Patterson
61774e0d49 please use ruby -I lib:test path/to/test.rb, or export RUBY_OPT 2011-06-06 15:47:13 -07:00
Jon Leighton
253bb6b926 Refactor Active Record test connection setup. Please see the 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. 2011-06-04 23:47:03 +01:00
Jon Leighton
d90b4e2615 Rewrote AssociationPreload. 2011-02-28 22:12:34 +00:00
Aaron Patterson
839f3bf682 just use a hash for doing association caching 2011-01-07 11:28:11 -08:00
Aaron Patterson
a6fe244e9b take more advantage of arel sql compiler 2010-12-25 15:23:45 -07:00
Aaron Patterson
ec13305b21 stop redifining methods on every call to set_primary_key 2010-12-24 22:15:41 -07:00
Aaron Patterson
064c28d6c2 fixing dup regressions 2010-11-23 14:29:05 -08:00
Aaron Patterson
0238228e5d type_name should check for blank because people may have messed up databases 2010-09-30 16:03:05 -07:00
José Valim
bd1666ad1d Add scoping and unscoped as the syntax to replace the old with_scope and 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
2010-06-29 17:18:55 +02:00
Neeraj Singh
39a246f545 Final iteration of use better testing methods
[#4652 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-19 21:31:51 +02:00
David Heinemeier Hansson
1459c8cc1d Changed ActiveRecord::Base.store_full_sti_class to be true by default reflecting the previously announced Rails 3 default [DHH] 2010-01-03 19:30:28 -08:00
Emilio Tagua
9520143159 Merge commit 'rails/master'
Conflicts:
	activerecord/test/cases/adapter_test.rb
	activerecord/test/cases/method_scoping_test.rb
2009-08-08 19:14:35 -03:00
Raimonds Simanovskis
42fd2a3b16 added :order to find :all as otherwise Oracle tests were failing 2009-08-06 23:40:59 +03:00
Emilio Tagua
cbf8ecc1cb Merge commit 'rails/master' 2009-06-30 20:32:28 -03:00
Pratik Naik
45e6f19925 Revert "Revert "Generate proper :counter_sql from :finder_sql when there is 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.
2009-07-01 00:02:00 +01:00
Yehuda Katz + Carl Lerche
80f1f863cd Revert "Generate proper :counter_sql from :finder_sql when there is a newline character immediately following 'SELECT' [#2118 state:resolved]"
This reverts commit 4851ca9e13a4317342df02ae25b1929340523f7a.

The tests do not pass for postgresql.
2009-06-22 12:04:02 -07:00
Patrick Joyce
4851ca9e13 Generate proper :counter_sql from :finder_sql when there is a newline character immediately following 'SELECT' [#2118 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-06-21 22:07:23 +01:00
Emilio Tagua
19d2ff83db Calculations now use Arel to construct the query.
Implemented other methods in AR::Base with Arel support.
2009-04-29 19:39:53 -03:00
Jeremy Kemper
1c36172c13 Ruby 1.9 compat: rename deprecated assert_raises to assert_raise.
[#1617 state:resolved]
2009-03-08 13:11:58 -07:00
Ken Collins
8e4624be9e Remove SQL Server cases from tests for latest adapter work to pass rails expected behavior.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-11-19 18:00:56 +01:00
rsl
6ce13429cb fixed association preloading to use = instead of IN when there's only one record
[#1013 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-09-10 14:11:00 -07:00
Tarmo Tänav
656f0e7c6c Fix file permissions
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-07-31 16:36:23 -05:00
Tiago Macedo
76df9fa068 Fix integer quoting issues in association preload. [#602 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-07-14 23:34:19 +01:00
Joshua Peek
c08547d226 Namespace Inflector, Dependencies, OrderedOptions, and TimeZone under ActiveSupport [#238 state:resolved] 2008-06-03 13:32:53 -05:00
rick
72483c0d4c Add ActiveRecord::Base.sti_name that checks ActiveRecord::Base#store_full_sti_class? and returns either the full or demodulized name. [rick] [#114 state:resolved] 2008-05-31 17:13:11 -07:00
Rodrigo Kochenburger
bca8751e40 Add ActiveRecord option to store the full class name on STI's type column, allowing one to have STI subclasses in different namespaces [#114]
Signed-off-by: rick <technoweenie@gmail.com>
2008-05-13 15:04:11 -07:00
Jeremy Kemper
39814fcce0 Merge branch 'ar-test-cleanup' of git://git.geeksomnia.com/rails
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8681 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-21 17:20:51 +00:00
Jeremy Kemper
1e70928014 Fix paths
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8661 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-18 07:31:37 +00:00
Jeremy Kemper
42b39ae3f2 Move tests to cases
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8660 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2008-01-18 07:30:42 +00:00