Commit Graph

2475 Commits

Author SHA1 Message Date
Pratik Naik
4918e6de98 Remove HasManyAssociationStrategy and move the logic to ActiveRecord::Reflection::ThroughReflection. 2008-10-04 17:49:39 +01:00
Pratik Naik
25ca21ae21 Introduce ActiveRecord::Reflection::ThroughReflection to simplify hm:t reflection logic 2008-10-04 17:49:39 +01:00
Zach Dennis
95e1cf4812 Fix has_many :through when the source is a belongs_to association. [#323 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-10-04 17:49:39 +01:00
Lawrence Pit
7659fb6a2b Try reloading model on class mismatch [#229 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-10-04 17:49:38 +01:00
Aliaksey Kandratsenka
f550c86257 Fix performance bug in AttibuteMethods#respond_to? in handling of private methods
We have hit dramatic increase in tests time after upgrading rails.
Profiling revealed this particular place. After this fix our test times returned
back to norm.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1173 state:committed]
2008-10-04 17:48:13 +02:00
Aliaksey Kandratsenka
834361145a made ConnectionPool#checkout more robust by trying to loot dead threads when pool is empty
Signed-off-by: Michael Koziarski <michael@koziarski.com>

[#1169 state:committed]
2008-10-04 17:48:13 +02:00
Aliaksey Kandratsenka
21eb18a70c Fix race in ConnectionPool#checkout
After releasing monitor some connection(s) may appear in pool before monitor is re-aquired.
When this happens we'll wait for connection which is already available.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-10-04 17:48:13 +02:00
Aliaksey Kandratsenka
4cb3d27443 don't quote decimal values for mysql. It doesn't make sense and breaks in newer versions of mysql
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1168 state:committed]
2008-10-04 17:48:13 +02:00
Luca Guidi
1bc267d216 Make sure recreate MySQL test database with the proper encoding and collation [#1165 state:resolved]
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1165 state:committed]
2008-10-03 22:08:55 +02:00
Michael Koziarski
7553a23c0a Remove AS for oracle compatibility 2008-10-03 21:35:01 +02:00
Eloy Duran
8d337e9ec2 Dynamic finders should use the ActiveRecord::Base::find method instead of ::find_initial, :find_last, and ::find_all.
This is so when people override ActiveRecord::Base::find, the new ::find method will also be invoked by the dynamic finders.
Associations for instance do go through ::find, so this makes it more consistent.
Also removed the unnecessary deprecation silence blocks.

Signed-off-by: Michael Koziarski <michael@koziarski.com>

[#1162 state:committed]
2008-10-03 21:28:11 +02:00
Will Bryant
35d731ef0a fix eager loading's :condition sanitizing expanding against the wrong table
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-09-29 17:49:44 +02:00
Will Bryant
8233f8314b wrote a test showing eager loading's misbehavior (sanitizing against the wrong table) when the association has a :conditions hash
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-09-29 17:49:44 +02:00
Tarmo Tänav
ea609b265f Ignore all exceptions for validates_acceptance_of columns fetch so it can run even without a database connection
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-09-26 20:09:39 +02:00
Adam Milligan
4d9a7ab5f5 Changed ActiveRecord attributes to respect access control.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1084 state:committed]
2008-09-24 19:40:07 +02:00
Hongli Lai (Phusion)
72b772ae9b Refactor configure_dependency_for_has_many to use a few more methods.
Add an additional conditions option to make it slightly easier for certain plugins.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1087 state:committed]
2008-09-24 13:27:39 +02:00
Pivotal Labs
487758b3b8 Allowed passing arrays-of-strings to :join everywhere. Merge duplicate join strings to avoid table aliasing problems.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1077 state:committed]
2008-09-24 13:26:06 +02:00
Hongli Lai (Phusion)
70b8ea4fa6 Make AssociationCollection start transactions in the correct database.
AssociationCollection now starts transactions by calling
AssociationCollection#transaction instead of @owner.transaction or
@reflection.klass.transaction.

Signed-off-by: Michael Koziarski <michael@koziarski.com>

[#1081 state:committed]
2008-09-23 20:32:01 +02:00
Michael Koziarski
638bd19c7f Merge branch 'patches' into multibyte 2008-09-22 21:35:35 +02:00
Michael Koziarski
5f86451a4c Bump the Version constants to align with the *next* release rather than the previous release.
This allows people tracking non-release gems or git submodules to use the constants.
2008-09-22 21:32:12 +02:00
Jan De Poorter
050e58441b Association#first and last should not load the association if not needed. [#1091 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-09-22 18:22:30 +01:00
Hongli Lai (Phusion
46939a9b5a Add Model#delete instance method, similar to Model.delete class method. [#1086 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-09-21 22:53:44 +01:00
Manfred Stienstra
1585a7ed02 Change all calls to String#chars to String#mb_chars. 2008-09-21 18:01:15 +02:00
Manfred Stienstra
52f8c04e1e Fix a test that assumes .mb_chars to always return an instance of the proxy_class. 2008-09-21 17:30:16 +02:00
Manfred Stienstra
7329990d86 Change all calls to String#chars to String#mb_chars. Remove a exception for Ruby <= 1.9. 2008-09-21 17:27:25 +02:00
Adeh DeSandies
de96a8666d applied patch to fix the associations with blocks in modules bug from an old trac ticket 2008-09-20 13:46:09 -07:00
Sven Fuchs
a3b7fa78bf I18n: Introduce I18n.load_path in favor of I18n.load_translations and change Simple backend to load translations lazily. [#1048 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-09-20 19:26:16 +01:00
Sven Fuchs
8cb7d46043 I18n: move old-style interpolation syntax deprecation to Active Record. [#1044 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-09-20 19:13:50 +01:00
Nathaniel Talbott
9d7f186f74 Fixed an error triggered by a reload followed by a foreign key assignment.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-09-20 14:16:43 +02:00
Michael Koziarski
4db7e8de11 Update the documentation to reflect the change handling :group earlier 2008-09-16 18:50:36 +02:00
miloops
dc8bf7515d When counting grouped records the target should be loaded to return a valid groups count result.
Without this change count_records will group for the count in the query and return erroneous results.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#937 state:committed]
2008-09-15 18:32:05 +02:00
Frederick Cheung
f636c6fda0 stop AR's debug.log filling with warnings about not being able to load fixture classes
[#1045 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-09-14 18:57:39 -07:00
Frederick Cheung
d51a39ff50 Deal with MySQL's quirky handling of defaults and blob/text columns
[#1043 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-09-14 17:11:22 -07:00
gbuesing
d95943b276 Multiparameter attributes skip time zone conversion for time-only columns [#1030 state:resolved] 2008-09-14 18:16:50 -05:00
miloops
9c4730d01e Base.skip_time_zone_conversion_for_attributes uses class_inheritable_accessor, so that subclasses don't overwrite Base [#346 state:resolved] 2008-09-14 17:18:17 -05:00
Pratik Naik
a17027d13a Merge docrails 2008-09-13 20:28:01 +01:00
Rich Cavanaugh
113de01eaf Allow for the dirty tracking to work with the aliased name of aliased attributes.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#812 state:committed]
2008-09-13 11:41:14 +02:00
Jon Leighton
fcf31cb752 Support for updating a belongs to association from the foreign key (without saving and reloading the record)
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#142 state:committed]
2008-09-13 11:08:29 +02:00
miloops
646b5bfa61 Use select and change test so new tests can work on postgres.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-09-12 12:27:03 +02:00
miloops
a37c5ae961 Improve test coverage when using the group option in find, has_many or has_and_belongs_to_many.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-09-11 22:51:57 +02:00
Michael Koziarski
095ad690f3 Remove the .to_s fix in validates_uniqueness_of, as Chars get quoted correctly. 2008-09-11 22:51:57 +02:00
Manfred Stienstra
babbc1580d Fix ActiveRecord::Base.quote_bound_value for ActiveSupper::Multibyte::Chars values.
- Adds String#acts_like_string?
- Adds Chars#acts_like_string?

Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1029 state:committed]
2008-09-11 22:51:26 +02:00
wmoxam
923f4ecad2 Fixes validates_uniquness_of problem with case insensitive string containing newline characters
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-09-11 17:40:14 +02:00
Michael Koziarski
9460d45988 Add missing assert_deprecated calls to prevent spam during test runs 2008-09-11 11:21:22 +02:00
Sven Fuchs
e826c99201 add activerecord tests to make sure the deprecated %s and %d interpolation syntax still works
[#1016 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-09-10 19:28:36 -07:00
Sven Fuchs
31dcd78111 add activerecord tests for deprecation of %s and %d in error messages (and translations in general)
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-09-10 19:28:36 -07:00
Sven Fuchs
79c8b104d6 change activerecord validation tests to not use the deprecated interpolation syntax any more
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-09-10 19:28:36 -07: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
Pratik Naik
9994f0d902 Revert "Add :accessible option to Associations for allowing mass assignments using hash. [#474 state:resolved]"
This reverts commit e0750d6a5c.

Conflicts:

	activerecord/CHANGELOG
	activerecord/lib/active_record/associations.rb
	activerecord/lib/active_record/associations/association_collection.rb
2008-09-10 18:50:01 +01:00
Rob Anderton
b518b6c0d3 Expanded documentation for new composed_of options
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#892 state:committed]
2008-09-10 18:28:57 +02:00