Commit Graph

6211 Commits

Author SHA1 Message Date
Dmitriy Kiriyenko
f1553731ed Add require ActiveSupport delegation to ActiveRecord::Relation class. 2011-07-07 17:32:18 +03:00
Santiago Pastorino
1bad08f116 Merge pull request #1120 from lysenko/collection_singular_ids
collection_singular_ids ignores association :include option
2011-07-06 20:13:24 -07:00
Santiago Pastorino
c6578d64ca Merge pull request #1989 from simonbaird/master
rake db:test:purge creates mysql database with wrong charset & collation (master branch)
2011-07-06 20:10:14 -07:00
Jon Leighton
86390c3bf3 Don't construct association scope in initializer. This yields a big performance gain for cases where the association is never used to load the target, for example with preloading. Related: #1873. 2011-07-07 01:07:31 +01:00
Simon Baird
ecd37084b2 Fix charset/collate in mysql recreate_database
See new method mysql_creation_options. It is used by both
create_database and recreate_database so they are consistent.

(Cherry pick of 3ba3125b24)
2011-07-07 09:27:51 +10: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
Ernie Miller
2bdad7669c Remove case statement changes from 2e0840d and 56ac32a. Inheritance FTW. 2011-07-06 16:13:57 -04: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
Xavier Noria
289b5253ce Merge branch 'master' of git://github.com/lifo/docrails 2011-07-05 01:42:13 +02:00
Dieter Komendera
7d3aa2462c Only call set_owner_attributes for has_one association if target exists. 2011-07-04 18:43:09 +02:00
Andrew White
9f7442a3ab Use an instance variable to store the current masss assignment options 2011-07-04 06:47:42 +01: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
Vijay Dev
007214cfb9 Revert "fix a typo"
Reason: Changelogs are not to be changed in docrails.

This reverts commit 0b8cdc16e0.
2011-07-02 13:58:26 +05:30
Aaron Patterson
36d289ad24 a few minor performance improvements: fewer strings, fewer range objects, fewer method calls 2011-07-01 15:20:11 -07:00
Aaron Patterson
2ed8097058 calling super is super. if the other object is exactly equal, we can return early 2011-07-01 14:38:22 -07:00
Aaron Patterson
06c72c43ba remove unused codes 2011-07-01 14:38:17 -07:00
Ray Baxter
0b8cdc16e0 fix a typo 2011-07-01 13:35:00 -07:00
Aaron Patterson
441d8ec130 reduce calls to owners_by_key and to read_attribute, respond_to? etc 2011-07-01 09:55:48 -07:00
Jon Leighton
cb99c8593a Remove AssociationReflection#create_association and AssociationReflection#create_association! - they are not called from anywhere. 2011-06-30 23:39:58 +01: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
6a283d598f match method signature of the superclass 2011-06-30 15:31:23 -07:00
Aaron Patterson
8e19a5dc4c call super rather than delegating to the other objects equal? method 2011-06-30 15:31:22 -07:00
Aaron Patterson
2545da6dd6 just alias eql? to == for frewer method calls 2011-06-30 15:31:22 -07:00
Aaron Patterson
f7bd07b62a only calculate method name once 2011-06-30 15:31:22 -07: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
Santiago Pastorino
35cdd256c0 Master version is 3.2.0.beta 2011-06-30 10:18:36 -03:00
Santiago Pastorino
a2a7a19d26 Bump up rack-cache and tzinfo 2011-06-30 10:07:26 -03: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
Jon Leighton
e9fa602e1c Define to_ary on ActiveRecord::Base to return nil. Improve performance of Array#flatten under 1.9, see comment for details. 2011-06-30 00:20:54 +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
56ac32ad51 Fix case 2011-06-28 22:31:24 +02:00
Oriol Gual
2e0840dd04 Update reverse order with new Arel Nodes 2011-06-28 22:22:26 +02: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
26caf32949 remove useless assignment 2011-06-28 10:57:56 -07:00
Aaron Patterson
13e79eb6c3 lock_optimistically is typically true, so evaluate the common failure case first 2011-06-28 10:51:23 -07:00
Aaron Patterson
02f45d6e0c reduce object allocation during AR instantiation 2011-06-28 10:22:39 -07:00
Aaron Patterson
9921eca51c remove the check for needs_type_condition? because ensure_proper_type will pick up the type column 2011-06-27 20:44:39 -07:00
Aaron Patterson
4006e738ed stop using && for the short circuit side effect 2011-06-27 18:16:01 -07:00
Aaron Patterson
4ec47cac10 let strings be converted to symbols inside the interpreter 2011-06-27 18:15:28 -07:00
Aaron Patterson
9152126110 avoice paying hash cost if there are no serialized attributes 2011-06-27 17:46:56 -07:00
Aaron Patterson
45b7209f1f cache column defaults for AR object instantiation 2011-06-27 17:45:34 -07:00