Commit Graph

2019 Commits

Author SHA1 Message Date
Michael Koziarski
9e2bb2caff Remove reference to fformat to restore support for postgres gem. 2008-10-26 20:04:09 +01:00
Adam Majer
932dffc559 Fix binary data corruption bug in PostgreSQL adaptor
1. Move the binary escape/unescape from column to the driver - we should store binary data AR just like most other adaptors
  2. check to make sure we only unescape bytea data
     PGresult.ftype( column ) == 17
  that is passed to us in escaped format
     PGresult.fformat( column ) == 0

Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1063 state:committed]
2008-10-25 12:54:48 +02:00
Mike Gunderloy
5c97d4ff29 "raise NoMethodError" raises NoMethodError. Raise it with NoMethodError.new instead.
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-10-25 14:52:44 +05:30
Ken Miller
8a77c4abfa Fixed issue where block is not called on the very first invocation of a find_or_create_by_ automatic finder.
[#1224 state:committed]
2008-10-24 21:35:05 +02:00
Jeremy Kemper
838cb1aa50 Skip collection ids reader optimization if using :finder_sql 2008-10-23 18:53:44 -07:00
Pratik Naik
a03e2b356c Merge with docrails. Also add a rake task to generate guides in your rails application :
rake doc:guides

The rake task will generate guides inside doc/guides directory of your application. Open index.html to browse.
2008-10-21 18:33:40 +01:00
Pratik Naik
95c609357e Ensure association proxy responds to private class methods defined in associated class. [#1083] 2008-10-16 23:17:49 +02:00
Pratik Naik
9cb5400871 Merge docrails 2008-10-16 22:13:06 +02:00
Ian White
517bc500ed Allow class methods to be sent (via #send) to association proxy (fix for bug introduced by 691aa20) [#1083]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-10-16 10:41:48 +02:00
Pratik Naik
691aa20280 Ensure methods called on association proxies respect access control. [#1083 state:resolved] [Adam Milligan, Pratik] 2008-10-13 19:02:34 +02:00
Michael Koziarski
cb45ee344d Remove the functionality introduce in 28d3390
There are several situations it doesn't cater for, and the inconsistency isn't worth blocking 2.2.
2008-10-10 17:04:46 +02:00
Will Bryant
4c05055487 explicitly including child associations that are also included in the parent association definition should not result in double records in the collection/double loads (#1110)
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1110 state:committed]
2008-10-10 16:58:39 +02:00
Hongli Lai (Phusion)
28393e6e9c Add documentation for AbstractAdapter#sanitize_limit, and make its code more readable.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1068 status:committed]
2008-10-09 18:11:10 +02:00
Pratik Naik
a2932784bb Merge docrails 2008-10-05 22:16:26 +01:00
Pratik Naik
9599948fbc Ensure Model.sum and Model.avg typecast appropriately. [#1066 state:resolved]
Model.sum delegates typecasting to the column being summed. If that's not feasible, returns a string.
Model.avg always returns big decimal.
2008-10-04 20:13:44 +01:00
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
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
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
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
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
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