Carlos Antonio da Silva
4e836e4de9
Refactor readonly attributes conditional
2011-12-04 09:21:34 -02:00
Arun Agrawal
ac4763f5c0
SQlite3 Bump
2011-12-04 10:27:44 +05:30
Jon Leighton
9c172b2931
Fix #3837 .
...
We also need to time zone convert time zone aware attributes when
accessed via read_attribute, not only when via direct access.
2011-12-03 16:46:46 +00:00
Xavier Noria
de24ed9f2d
removes the convenience instance version of AR::Base.silence_auto_explain
...
Rationale: As discussed with José and Jon, this convenience
shortcut is not clearly justified and it could let the user
thing the disabled EXPLAINs are related to the model instance
rather than being globally disabled.
2011-12-03 14:26:34 +01:00
Jon Leighton
a02691ce09
Merge pull request #3820 from jaylevitt/nested_loading_through_assoc
...
reintroduce patch from #726 to handle nested eager loading via associations
2011-12-03 04:01:14 -08:00
Jon Leighton
2e902d52eb
Merge pull request #3833 from kennyj/fix_3678-3
...
Use show create table (fix 3678: third time).
2011-12-03 03:36:00 -08:00
Xavier Noria
3a967806ad
yield > block.call
2011-12-02 11:44:04 -08:00
Xavier Noria
15dab0d2f5
two small details from the previous patch
2011-12-02 11:29:35 -08:00
Xavier Noria
0be5adaedf
implements AR::Base(.|#)silence_auto_explain
2011-12-02 11:16:26 -08:00
Arun Agrawal
9a59475d4a
indentation fix warning
2011-12-02 22:55:15 +05:30
kennyj
f3470b08c9
Use show create table.
2011-12-03 02:21:56 +09:00
Xavier Noria
36cc1f78eb
revises some details in the previous explain patch
2011-12-02 09:19:13 -08:00
Jon Leighton
9acb340e88
Revert "Roflscaling!" (for now)
...
This reverts commit f6b5046305 .
Fear not, the roflscale will return when I have a bit more time and
figure out a better way to do it. (In particular, a way that doesn't
break the build.)
2011-12-02 13:23:31 +00:00
Xavier Noria
0306f82e0c
implements automatic EXPLAIN logging for slow queries
2011-12-02 04:35:43 -08:00
Jon Leighton
6bff6439b1
Fewer string allocations in attribute method
2011-12-01 23:41:51 +00:00
Jon Leighton
f6b5046305
Roflscaling!
...
Don't prefix the name with attribute_. Avoids a string allocation on
read_attribute, which is a bit faster.
2011-12-01 23:41:51 +00:00
Jon Leighton
9ead4130de
Create method with known identifier then alias into place.
...
This means we never have to rely on define_method (which is slower and
uses more memory), even when we have attributes containing characters
that are not allowed in standard method names.
(I am mainly changing this because the duplication annoys me, though.)
2011-12-01 23:41:51 +00:00
Jon Leighton
bd920eae82
Remove some unnecessary code etc
2011-12-01 23:41:51 +00:00
Jon Leighton
e9fb6d04bd
Add test for read_attribute(:id) with non-standard PK.
...
Also make it actually work.
It slows down all read_attribute accesses to map 'id' to whatever the PK
actually is, inside read_attribute. So instead make sure the necessary
methods are defined and that they redirect wherever they need to go.
2011-12-01 23:41:51 +00:00
Jon Leighton
f1a534af98
Remove the need for type_cast_attribute.
...
This is good because it reduces duplication.
2011-12-01 23:41:51 +00:00
Jon Leighton
3a40d38619
Get rid of the underscore versions of attribute methods!
...
This makes me happy!
2011-12-01 23:41:51 +00:00
Jon Leighton
3dcb127109
Don't rely on underscore-prefixed attribute methods.
...
Define singleton methods on the attributes module instead. This reduces
method pollution on the actual model classes. It also seems to make
something faster, I am unsure why! O_o
2011-12-01 23:41:51 +00:00
Jon Leighton
365e10b8dc
Remove unnecessary *args
2011-12-01 23:41:51 +00:00
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
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
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
Jay Levitt
24b8814db0
reintroduce patch from #726 to handle nested eager loading via associations
2011-11-30 18:12:24 -05: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
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
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