Commit Graph

6664 Commits

Author SHA1 Message Date
José Valim
b4359bc723 Allow rescue responses to be configured through a railtie. 2011-12-01 19:21:35 +01:00
Jon Leighton
52eedf5e2b Add hackery to make Syck use encode_with/init_with. Fixes 1.8 after recent changes to attribute serialization. 2011-12-01 01:15:16 +00:00
Jon Leighton
1c783c6040 don't alter global state in test 2011-11-30 23:47:16 +00:00
Julius de Bruijn
4e380828ff If the table behind has no primary key, do not ask again and just return nil. 2011-11-30 23:47:16 +00:00
Jon Leighton
7a4949e7d5 consistency 2011-11-30 23:18:41 +00:00
Jon Leighton
d5f7884dc5 Don't check column type, you might implement a custom coder that serializes to a different type 2011-11-30 23:18:40 +00:00
Jon Leighton
7895182d0f omg computer science!
Implement a mini state machine for serialized attributes. This means we
do not have to deserialize the values upon initialization, which means
that if we never actually access the attribute, we never have to
deserialize it.
2011-11-30 23:18:40 +00:00
Jon Leighton
4f20eb5908 Fix typo 2011-11-30 23:18:40 +00:00
Jon Leighton
035b4244ba Don't need second param 2011-11-30 23:18:40 +00:00
Jon Leighton
efcc95acb7 No longer need to undef id as we are defining it ourselves 2011-11-30 23:18:40 +00:00
Jon Leighton
6c63f1aa44 Move some serialization stuff out of Base 2011-11-30 23:18:40 +00:00
Jon Leighton
f4853dc174 Extract attribute serialization code into a separate module 2011-11-30 23:18:40 +00:00
Jon Leighton
61489dc684 Use inheritance to avoid special-case code for the 'id' method 2011-11-30 23:18:40 +00:00
Jon Leighton
4c33d517d9 #id is an alias for whatever the primary key is 2011-11-30 23:18:40 +00:00
Jon Leighton
40840aa9ea fix indent 2011-11-30 23:18:40 +00:00
Vijay Dev
04b4fe77c9 s/is is/is 2011-12-01 01:42:54 +05:30
José Valim
5b2eb64ceb Revert "Implement ArraySerializer and move old serialization API to a new namespace."
This reverts commit 8896b4fdc8.

Conflicts:

	activemodel/lib/active_model.rb
	activemodel/lib/active_model/serializable.rb
	activemodel/lib/active_model/serializer.rb
	activemodel/test/cases/serializer_test.rb
2011-11-30 18:48:17 +01:00
Bogdan Gusiev
a382d60f6a ActiveRecord::Relation#pluck method 2011-11-30 11:03:00 +02:00
Aaron Patterson
c606fe2c6f push synchronization in to each method. Reduces method calls and makes
it clear which methods are synchronized.
2011-11-29 15:30:04 -08:00
Aaron Patterson
0e2477b602 Automatic closure of connections in threads is deprecated. For example
the following code is deprecated:

Thread.new { Post.find(1) }.join

It should be changed to close the database connection at the end of
the thread:

Thread.new {
  Post.find(1)
  Post.connection.close
}.join

Only people who spawn threads in their application code need to worry
about this change.
2011-11-29 15:04:41 -08:00
Aaron Patterson
29d2040b29 AbstractAdapter#close can be called to add the connection back to the
pool.
2011-11-29 14:40:37 -08:00
Aaron Patterson
ce3d8d646a Start implementing @reserved_connections in terms of connection leases. 2011-11-29 14:02:59 -08:00
Aaron Patterson
5725e397fe Rename checked_out to more descriptive active_connections 2011-11-29 14:02:59 -08:00
Aaron Patterson
b72b477c37 Use connection lease to determine "checked_out" connections 2011-11-29 14:02:59 -08:00
Aaron Patterson
f866f66b30 expire will set in_use to false 2011-11-29 14:02:58 -08:00
Aaron Patterson
79306de791 last_use is set on connection lease 2011-11-29 14:02:58 -08:00
Aaron Patterson
134cc8f939 Leased connections return false on second lease 2011-11-29 14:02:58 -08:00
Aaron Patterson
9bf8bf82b9 Adapters keep in_use flag when leased 2011-11-29 14:02:58 -08:00
Aaron Patterson
7837574e5b namespace the adapter test 2011-11-29 14:02:58 -08:00
Jon Leighton
3da5fba56a Fix ruby 1.8 compat. const_defined? only takes a second arg on 1.9. 2011-11-29 20:43:05 +00:00
Jon Leighton
8df787d428 Deprecated define_attr_method in ActiveModel::AttributeMethods
This only existed to support methods like `set_table_name` in Active
Record, which are themselves being deprecated.
2011-11-29 20:13:37 +00:00
Jon Leighton
f3c84dc316 Deprecate set_locking_column in favour of self.locking_column= 2011-11-29 20:13:37 +00:00
Jon Leighton
1a474cc8e4 Deprecate set_primary_key in favour of self.primary_key= 2011-11-29 20:13:37 +00:00
Jon Leighton
4aad289428 Make sure the original_foo accessor still works (but deprecated) if we are using self.foo= 2011-11-29 20:13:37 +00:00
Jon Leighton
e51ecfaaa3 extract method 2011-11-29 20:13:37 +00:00
Jon Leighton
7af719e81c Deprecate set_sequence_name in favour of self.sequence_name= 2011-11-29 20:13:37 +00:00
Jon Leighton
fd7ca98bb6 Add tests for set_sequence_name etc 2011-11-29 20:13:36 +00:00
Jon Leighton
34609d67b4 Deprecate set_inheritance_column in favour of self.inheritance_column= 2011-11-29 20:13:36 +00:00
Jon Leighton
0b72a04d0c Deprecate set_table_name in favour of self.table_name= or defining your own method. 2011-11-29 20:13:36 +00:00
Aaron Patterson
f73f53455a respond_to? information of AR is not the responsibility of the spec
resolver.
2011-11-29 11:48:55 -08:00
Jon Leighton
2169603385 Merge pull request #3636 from joshsusser/master
association methods are now generated in modules
2011-11-29 10:09:42 -08:00
Josh Susser
c347b3c06c don't change class definition in test case 2011-11-29 09:14:21 -08:00
Jon Leighton
d534c8fbe2 Fix resolver_test.rb on travis (postgresql isn't setup, so it can't load the connection adapter) 2011-11-29 12:47:54 +00:00
Jon Leighton
1defb6adb8 Fix schema_cache_test.rb for sqlite3_mem 2011-11-29 12:29:42 +00:00
Sergey Parizhskiy
69d56cb933 splited a long line to shorter ones 2011-11-29 11:50:02 +02:00
Aaron Patterson
52a9884ce4 remove unused instance variable 2011-11-28 15:23:26 -08:00
Aaron Patterson
beff819a4d just check in all connections 2011-11-28 15:23:26 -08:00
Aaron Patterson
884a04007f remove useless class_eval 2011-11-28 15:23:25 -08:00
Aaron Patterson
dde2113867 Move connection resoluion logic to it's own testable class. 2011-11-28 15:23:25 -08:00
Aaron Patterson
30f7c59e90 clean up string => hash conversion for connection pool 2011-11-28 15:23:25 -08:00