Commit Graph

2463 Commits

Author SHA1 Message Date
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
Rob Anderton
2cee51d5c1 Added :constructor and :converter options to composed_of and deprecated the conversion block
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-09-10 18:28:47 +02:00
Tarmo Tänav
7c9851dbb6 Support :limit on update_all so that has_many with :limit can be safely updated
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-09-10 13:41:49 +02:00
Tarmo Tänav
14d1560e85 Fixed test_find_last_by_one_attribute_caches_dynamic_finder for postgresql 8.3
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-09-10 13:40:45 +02:00
David Heinemeier Hansson
6dc9173a63 Missing doc updates 2008-09-09 23:59:54 -05:00
miloops
567392bff3 Added find_last_by dynamic finder [status:committed #762]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2008-09-09 23:44:52 -05:00
Hongli Lai (Phusion)
1398db0128 Add special AssociationReflection methods for creating association objects, and modify the code base to use those methods instead of creating association objects directly. This allows plugins to hook into association object creation behavior.
[#986 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-09-09 13:13:12 -07:00
Hongli Lai (Phusion)
1692940441 Make the options that has_many, belongs_to and other association generation methods can accept, configurable.
[#985 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-09-09 12:50:32 -07:00
Michael Koziarski
07913788f9 Interpolation requires double quotes 2008-09-09 21:16:06 +02:00
Jeremy Kemper
4f6875296f Revert "Revert "Raise UnknownAttributeError when unknown attributes are supplied via mass assignment""
This reverts commit 41efd73887.
2008-09-08 09:45:26 -07:00
Jeremy Kemper
41efd73887 Revert "Raise UnknownAttributeError when unknown attributes are supplied via mass assignment"
This reverts commit 108db00aa9.
2008-09-06 21:01:45 -07:00
David Heinemeier Hansson
227ee2ecb4 Use a more sensible resolution on the new millisecond benchmarks 2008-09-05 14:58:34 +02:00
David Heinemeier Hansson
de0e7507de Changed all benchmarking reports to be in milliseconds 2008-09-05 14:22:57 +02:00