Commit Graph

1306 Commits

Author SHA1 Message Date
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
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
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
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
Jeremy Kemper
cd498e2588 Rescue spurious failures in case dummy postgresql user or schema already exists 2008-09-04 17:20:07 +02:00
Nick Sieger
a3f12f575d Default connection allow_concurrency to false (for PostgreSQL)
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-09-04 15:44:05 +02:00
Nick Sieger
7ba2872615 Deprecate verification_timeout and verify before reset
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-09-04 14:36:09 +02:00
Jeremy Kemper
f54be2cb31 Fix transaction exception test 2008-09-04 13:24:55 +02:00
Jeremy Kemper
6f932b4790 Database connections are now pooled, one pool per #establish_connection call.
Pools start out empty and grow as necessary to a maximum size (default is 5,
configure size with key 'pool' in your database configuration). If no
connections are available, a thread will wait up to a 'wait_timeout' time
(default is 5 seconds).

Connections are verified and reset when checked out from the pool (usually
upon first access to ActiveRecord::Base.connection), and returned back to the
pool after each request.

If you would like to use connection pools outside of ActionPack, there is an
ActiveRecord::Base.connection_pool method that gives you access to the pool,
and you can manually checkout/checkin connections, or supply a block to
ActiveRecord::Base.connection_pool.with_connection which takes care of the
checkout/checkin for you.

[#936 state:resolved]
2008-09-02 18:32:54 +02:00
Iain Hecker
76797b4439 translates when a message symbol has been set on builtin validations
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-31 13:24:08 -07:00
Jeremy Kemper
c50223b76f Fix tests that assumed implicit order by id 2008-08-30 22:47:28 -07:00
miloops
b163d83b8b Performance: Better query for ASSOCIATION_ids. Select only ids if the association hasn't been loaded.
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-30 15:24:09 -07:00
Tom Stuart
7f179f8540 Make NamedScope#size behave identically to AssociationCollection#size. [#933 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-08-29 22:18:49 +01:00
Nick Sieger
d07a6b1a4a Make clear_active_connections! also return stale connections back to the pool
- also clean up some cruft remaining from per-thread connection cache
2008-08-29 14:12:12 -05:00
Nick Sieger
212134dce1 Remove CachedConnectionPerThread per-thread pooling mechanism in favor of a fixed pool with default maximum of 5 connections 2008-08-29 14:12:12 -05:00
Nick Sieger
ca6d71753f Deprecate allow_concurrency and make it have no effect 2008-08-29 14:12:12 -05:00
Nick Sieger
d7d2d73d88 Fix typo: was using brackets instead of parens. Must need more sleep. 2008-08-29 14:12:11 -05:00
Nick Sieger
3ce64d4f16 Fix checkin method, add a couple more tests 2008-08-29 14:12:11 -05:00
Nick Sieger
fe575dd4a9 Nearing the finish line. Initial fixed-size connection pool implemented, more docs 2008-08-29 14:12:11 -05:00
Nick
50cd4bdc99 Introduce synchronization around connection pool access
- use new active support Module#synchronize
- allow_concurrency now switches between a null monitor and a
  regular monitor (defaulting to null monitor to avoid overhead)
2008-08-29 14:12:09 -05:00
Nick
5879b15f23 Rename defined_connections to connection_pools
- Distinguis meaning of "active_connections" to always mean connections
  associated with the current thread
2008-08-29 14:12:08 -05:00
Nick
6edaa26717 Initial conversion to connection pool
So far so good, tests still run clean. Next steps: synchronize connection pool access
and modification, and change allow_concurrency to simply switch a real lock for a
null lock.
2008-08-29 14:12:08 -05:00
Eugene Pimenov
743f0e7114 Make case insensitive validates_uniqueness_of use unicode aware downcase method.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-08-29 20:24:20 +02:00
Michael Koziarski
6769d824f9 Fix parentheses warnings 2008-08-29 15:27:34 +02:00
Jan De Poorter
db116a2ed6 Fix NamedScope regex so methods containing "an" get delegated to proxy_found. [#901 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-08-29 14:06:37 +01:00
Andrew White
db22c89543 Merge scoped :joins together instead of overwriting them. May expose scoping bugs in your code!
[#501 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-28 12:07:15 -07:00
Ernie Miller
44af2efa2c Refactored AssociationCollection#count for uniformity and Ruby 1.8.7 support.
[#831 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-28 11:58:25 -07:00
Tarmo Tänav
96c6fe0842 Implement count limit/offset support for has_many associations
[#348 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-27 23:32:21 -07:00
Tarmo Tänav
13671cc565 Alias included associations if needed when doing a count
[#302 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-27 23:29:29 -07:00
Tom Lea
ad562c58ea Dirty: treat two changes resulting in the original value as being unchanged.
[#798 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-27 23:13:41 -07:00
Jeremy Kemper
657898c821 Merge commit 'sven/i18n'
Conflicts:
	activesupport/lib/active_support.rb
2008-08-27 12:31:07 -07:00
pivotal
9dbde4f5cb Fix two has_one :through errors
* Set the association target on assignment;
* Reset target to nil on reset, rather than empty array.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#895 state:committed]
2008-08-27 11:22:15 +02:00
Marko Seppae
2d03a4c668 i18n: fixed failing tests after removing #populate and #store_translations 2008-08-27 10:37:01 +02:00
Tarmo Tänav
eec5eb2e44 Fix yet another implicit order dependant test
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-08-26 13:16:55 +02:00
Tarmo Tänav
ce3c76de7c Just look at sql_type when testing that the correct database-specific type was used
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-08-26 12:11:01 +02:00
Jeremy Kemper
ab1e82b8f7 Include people and readers fixtures to fix test isolation error 2008-08-26 02:38:48 -07:00
Jeremy Kemper
0c7bbc72fc fix tests relying on implicit ordering 2008-08-26 02:17:36 -07:00
Tarmo Tänav
973c0ef26d Create mysql binary_fields table with latin1 character set as with utf8 all the limits would have to be divided by 3 to get the expected text types
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-26 01:49:19 -07:00
Tarmo Tänav
fa795ccfad Include mysql older than 5.1.23 in the 5.1 series in the list of those that can't handle NULL defaults
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-26 00:53:19 -07:00
Jeremy Kemper
52e15abbed um.. yeah 2008-08-26 00:10:16 -07:00
Jeremy Kemper
6d66ddaa34 typo 2008-08-26 00:02:30 -07:00
Jeremy Kemper
842d55cb16 fix another ordering failure 2008-08-26 00:02:22 -07:00
Jeremy Kemper
ca48da6300 fix tests relying on implicit ordering 2008-08-25 23:53:31 -07:00
Josh Susser
1092c181b5 add dynamic finder bang version to raise RecordNotFound
[#905 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-25 23:33:16 -07:00
Josh Susser
143f5fbb21 refactor dynamic finder name matching into its own class
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-25 23:32:20 -07:00
Jeremy Kemper
3beed9cdb7 ensure tests load sibling Active Support instead of a gem 2008-08-25 23:32:03 -07:00