Commit Graph

3015 Commits

Author SHA1 Message Date
Franck Verrot
5004aaffc1 Simplify the test by using id and name. id will be the only real sort criteria in any case as it's unique. 2011-08-13 16:22:16 -07:00
Santiago Pastorino
64affc9384 Merge pull request #2236 from cldwalker/after_initialize
Fix after_initialize and Base.create edge case
2011-07-25 07:20:38 -07:00
thedarkone
10863580aa Bring back the ability to provide :order for update_all. 2011-07-25 13:33:44 +02:00
Aaron Patterson
02691d3516 Merge pull request #2238 from cesario/order-with-extra-spaces
Ordering with extra spaces was raising a SQL exception
2011-07-24 14:40:15 -07:00
Gabriel Horner
f5e4d13270 use existing model for testing Base.create with #after_initialize 2011-07-24 16:36:06 -04:00
Xavier Noria
4bb0a8bcbd Merge branch 'master' of git://github.com/lifo/docrails 2011-07-24 21:02:51 +02:00
Oemuer Oezkir
71d18ce48e Changed a few instances of of words in the API docs written in British English to
American English(according to Weber)
2011-07-24 10:21:42 +00:00
Franck Verrot
77bb0b79f2 Ordering with extra spaces was raising a SQL exception 2011-07-24 08:18:04 +02:00
Gabriel Horner
6e3c0a5d9a simplify and be more explicit about create and after_initialize tests 2011-07-24 00:31:37 -04:00
Les Fletcher
f956759f8a fix after_initialize edge case (close #2074 and close #2175)
fix behavior when after_initialize is defined and a block is passed to Base.create
2011-07-24 00:31:28 -04:00
Xavier Noria
a62f450661 Merge pull request #2086 from amatsuda/date_multiparameter_nil
convert multiple Date parameters into a nil if any of its bits were blank
2011-07-23 11:20:12 -07:00
Aaron Patterson
253b472838 forgot to add this test case 2011-07-22 09:12:32 -07:00
Aaron Patterson
1a0b7ea3c9 adding more tests around database uri parsing 2011-07-21 12:57:05 -07:00
Aaron Patterson
f4ed975125 move around tests 2011-07-21 11:54:29 -07:00
Terence Lee
16921437a1 fix postgres connection url test 2011-07-20 16:23:31 -07:00
Glenn Gillen
16249feaab Added test for postgres connections as URL. Fixed query param parsing. 2011-07-20 16:23:31 -07:00
Glenn Gillen
89357c8f83 Provide database connection settings as a URL. 2011-07-20 16:23:31 -07:00
Franck Verrot
8bc314b3b7 assign_nested_attributes_for_collection_association should work with Ruby 1.9 [Closes #2106]
Children attributes can be either String's or Symbol's, so let's check if the object responds to to_i.
2011-07-20 15:40:01 -07:00
Aaron Patterson
d8736b266b Revert "this fixes a brittle test in fixtures_test.rb which fails when you are in a timezone which is ahead of UTC but UTC is in the previous day still."
This reverts commit f92cefa95f.
2011-07-20 15:37:52 -07:00
Aaron Patterson
09a488456a bigdecimal should be typecast to a float on sqlite3. fixes #2162 2011-07-20 14:39:01 -07:00
Josh Kalderimis
f92cefa95f this fixes a brittle test in fixtures_test.rb which fails when you are in a timezone which is ahead of UTC but UTC is in the previous day still. 2011-07-20 01:00:35 +02:00
Elliot Winkler
0e1d617b8b ActiveRecord: Fix eager loading so that giving a blank order clause generates valid SQL 2011-07-18 14:56:37 -06:00
José Valim
da144894e9 Merge pull request #195 from bigfix/active_model_include_serialization
ActiveModel support for the :include serialization option
2011-07-18 06:50:43 -07:00
Prem Sichanugrist
4443905169 Refactor test case to use anonymous class - Thank you @tenderlove 2011-07-18 00:37:06 -04:00
Prem Sichanugrist
6e6994994d Raise an ArgumentError if user passing less number of argument in the dynamic finder
The previous behavior was unintentional, and some people was relying on it. Now the dynamic finder will always expecting the number of arguments to be equal or greater (so you can still pass the options to it.)

So if you were doing this and expecting the second argument to be nil:

    User.find_by_username_and_group("sikachu")

You'll now get `ArgumentError: wrong number of arguments (1 for 2).` You'll then have to do this:

    User.find_by_username_and_group("sikachu", nil)
2011-07-17 18:44:03 -04:00
Jon Leighton
ac97e25235 Revert "Fix failure in test_preserves_existing_fixture_data from test/cases/fixtures_test.rb when UTC and local time occur on different dates." I am pretty sure this was an incorrect fix, and it still failed in certain circumstances anyway. I am now unable to reproduce the original failure I was experiencing so will leave it for now and see if this pops up again.
This reverts commit e4479b2f1b.
2011-07-17 19:55:05 +01:00
John Firebaugh
1723a7a6c6 Move to_xml tests to xml_serialization_test.rb
One duplicate was eliminated: test_to_xml_including_methods/
test_methods_are_called_on_object.
2011-07-17 11:34:07 -07:00
Akira Matsuda
9cd1f754d0 convert multiple Date parameters into a nil if any of its bits were blank 2011-07-15 21:19:23 +09:00
Santiago Pastorino
31ea0276a4 Merge pull request #2063 from elight/master
Patch for https://github.com/rails/rails/issues/2059
2011-07-14 11:14:27 -07:00
Evan Light
f13dea8a34 Fix and unit test for https://github.com/rails/rails/issues/2059
Cache key was incorrectly using timezone-dependent record#updated_at when it should be using a timezone-independent value to generate the cache key

Minor refactoring to cache_key timezone test

Closes #2059

Adds a test to validate the format of the cache_key for nil and present updated_at values

Correctly handles updated_at == nil
2011-07-14 14:04:02 -04:00
Santiago Pastorino
d632e927ec Merge pull request #1807 from caius/find_in_batches_id_bug
Bugfix by stopping find_in_batches using the records after yielding.
2011-07-14 07:57:04 -07:00
Jon Leighton
e4479b2f1b Fix failure in test_preserves_existing_fixture_data from test/cases/fixtures_test.rb when UTC and local time occur on different dates. 2011-07-12 00:14:45 +01:00
Jon Leighton
1712d90050 Fix exception if old and new targets are both nil. Fixes #1471. 2011-07-12 00:14:45 +01:00
Santiago Pastorino
539d684b7a Merge pull request #1929 from sobrinho/master
Create a test case for disable_referential_integrity
2011-07-11 06:00:59 -07:00
Santiago Pastorino
c3732bfed0 Merge pull request #1823 from gnarg/master
Log instrumentation name for exists? queries
2011-07-10 18:02:31 -07:00
Santiago Pastorino
c5448721b5 to_key on a destroyed model should return nil 2011-07-09 15:36:57 -03:00
Akira Matsuda
7c921fbf15 formats 2011-07-09 20:14:41 +09:00
Akira Matsuda
d1545bcf94 fix AR having() not to raise NoMethodError when the given argument does not respond to empty?
having raises NoMethodError: undefined method `empty?' when a Fixnum or Date/Time were passed via varargs
2011-07-09 20:14:41 +09:00
Jon Leighton
111968d402 Foo.joins(:bar).includes(:bar) should result in a single query with :bar as a join. Related: #1873. 2011-07-09 11:39:04 +01:00
José Valim
6917c65f04 Merge pull request #2017 from Casecommons/active_record_lint
ActiveRecord::Base subclasses should pass ActiveModel::Lint.
2011-07-08 18:34:02 -07:00
Grant Hutchins & Peter Jaros
6b9c38c1a8 ActiveRecord::Base should pass ActiveModel::Lint. 2011-07-08 17:51:40 -04:00
Tomas D'Stefano
ea4b94a7bf Destroy association habtm record before destroying the record itself. Fixes issue #402. 2011-07-08 22:26:54 +01:00
Jon Leighton
dfec3737b0 Ensure that the foreign key gets set when doing record.create_association or record.create_association. Fixes #1960. 2011-07-08 21:03:54 +01:00
Daniel Schierbeck
9991f0f15a Refactor PostgreSQLAdapter a bit
Move the private method #extract_schema_and_table into a separate
Utils module so that it can be tested without resorting to #send.
2011-07-08 16:05:55 +02:00
Akira Matsuda
dab0de4a20 Use Enumerable#with_index. We're on Ruby > 1.8.7 (part II) 2011-07-08 21:45:41 +09:00
knapo
2ca9b6dfab Make ActiveRecord::Batches#find_each to not return self.
This caused that `find_each` was producing extra db call taking all the records from db, and was less efficient than `ActiveRecord::Base#all`.
2011-07-07 11:40:11 +02:00
Anatoliy Lysenko
66dd2d3d10 Fix bug in collection_singular_ids on has many through association with conditions and includes,
when condtions references tables from includes.
Test fail because of invalid sql:
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: comments.id:
SELECT "posts".id FROM "posts" INNER JOIN "readers" ON "posts"."id" = "readers"."post_id"
WHERE "readers"."person_id" = 1 AND (comments.id is null)

Bug described in github#925

This commit will revert fix from 3436fdfc12 , but tests is ok.

Bug described in #6569 ticket.
2011-07-06 23:23:34 +03:00
Santiago Pastorino
c713cf9a5d Merge pull request #1273 from jeremyf/feature-association-proxy-send
Addresses an inconsistency in the ActiveRecord::Base.method_missing handl
2011-07-06 13:05:58 -07:00
Santiago Pastorino
d5bd7030e5 Merge pull request #1494 from anildigital/master
Fix failing test because of Timezone difference.
2011-07-06 12:23:19 -07:00
Jon Leighton
2c72830cd9 Merge pull request #1979 from bogdan/association_sum_array_compatibility
Fixed AR::Relation#sum compatibility with Array#sum
2011-07-06 00:49:05 -07:00