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
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
Santiago Pastorino
b27871a66f
Merge pull request #1968 from bogdan/associations_find_array_compatibility2
...
Fixed CollectionAssociation#find to be compatible with Array#find
2011-07-05 09:41:09 -07:00
Bogdan Gusiev
e7bec4e435
Fixed AR::Relation#sum compatibility with Array#sum
...
In order make Relation behavior closer to Array
Made Relation#sum to accept block and delegate it to Array#sum
2011-07-05 14:36:20 +03:00
Bogdan Gusiev
8ba0c1ac53
Fixed CollectionAssociation#find to be compatible with Array#find
...
In order to make CollectionAssociation behave closer to Array
Add the ability to pass block to #find method just like Array#find does.
2011-07-05 10:51:40 +03:00
Dieter Komendera
7d3aa2462c
Only call set_owner_attributes for has_one association if target exists.
2011-07-04 18:43:09 +02:00
Vijay Dev
15f35c0ac0
Reversing the changes done in c278a2c while still resolving #1857 .
...
The changes broke bulk migration tests and were fixed in 4d256bc6;
however that brought back the issue of #1857 and so this commit goes
back to the original scenario and just adds change_table to the list
of methods which are to be recorded in the CommandRecorder. The
method_missing now delegates all calls to the underlying connection as
before.
2011-07-02 23:43:13 +05:30
Gabriel Sobrinho
5399471820
Create a test case for disable_referential_integrity
2011-07-01 10:04:10 -03:00
Jon Leighton
0e225ec583
Assign the association attributes to the associated record before the before_initialize callback of the record runs. Fixes #1842 .
2011-06-30 23:39:58 +01:00
Aaron Patterson
f261ef42cc
cache the plural name on the reflection so we do not pay pluralize costs on joins
2011-06-30 15:31:22 -07:00
Jon Leighton
4d256bc6b1
CommandRecorder should delegate in method_missing where possible. Fixes some tests in migration_test.rb under mysql. The problem was introduced in c278a2c5e1.
2011-06-30 00:47:35 +01:00
Aaron Patterson
59e38803e9
Merge pull request #1574 from oriolgual/1571_ar_relation_order_no_longer_works_with_arel_nodes
...
Fix #1571 ActiveRecord::Relation#order no longer works with arel ordering nodes
2011-06-28 14:55:15 -07:00
Oriol Gual
eb933f0154
Add more test cases
2011-06-28 22:10:51 +02:00
Oriol Gual
e174923d29
Add failing test
2011-06-28 22:10:50 +02:00
Raimonds Simanovskis
f838b47b87
Fix test_finding_with_cross_table_order_and_limit for Oracle
...
Use latest Arel syntax and pass each order by expression as separate argument to order method as otherwise invalid Oracle SQL is generated.
2011-06-28 23:04:42 +03:00
Aaron Patterson
941d5c1f40
Merge pull request #1857 from vijaydev/irreversible-migration
...
IrreversibleMigration is not raised when a method not supported by reversible migrations is called in the change method of a migration
2011-06-28 12:05:19 -07:00
Aaron Patterson
a5cb5a5af6
Merge pull request #1860 from dmathieu/comparison
...
Allow comparison on model objects - Closes #1858
2011-06-28 11:46:25 -07:00
Aaron Patterson
6054c092dc
oops! remove debugging codes
2011-06-27 14:46:56 -07:00
Aaron Patterson
997aed24be
default create_with_value to a hash so we can eliminate conditionals, add test surrounding create_with(nil) behavior
2011-06-27 14:18:49 -07:00
Damien Mathieu
eb22c51173
comparing different classes returns nil
2011-06-26 09:41:30 +02:00
Damien Mathieu
bc743dc1ce
allow comparison on model objects - Closes #1858
2011-06-26 09:41:08 +02:00
Vijay Dev
c278a2c5e1
record unsupported methods in CommandRecorder instead of letting the unsupported methods go through to the underlying db causing errors like duplicate columns to occur when rolling back migrations
2011-06-25 17:17:02 +05:30
Santiago Pastorino
d6413f043c
Merge pull request #1848 from raviolicode/postgresql_order_multiple_params
...
Fix for complex ordering of multiple columns on postgresql
2011-06-24 13:09:33 -07:00
Lucia Escanellas
9734a416fa
Improve ordering of multiple columns on postgresql
...
* Only on postgresql, order("first asc, second asc") was invalid
* Closes #1720
2011-06-24 13:37:08 -03:00