aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #3854 from exviva/validates_associated_marked_for_destructionJosé Valim2011-12-041-2/+3
|\ | | | | Do not validate associated records marked for destruction
| * Do not validate associated records marked for destructionOlek Janiszewski2011-12-051-2/+3
| | | | | | | | | | | | The main reason for this change is to fix a bug where `validates_associated` would prevent `accepts_nested_attributes_for` with `allow_destroy: true` from destroying invalid associated records.
* | Merge pull request #3851 from ebeigarts/fix_sequence_nameJon Leighton2011-12-041-2/+2
|\ \ | |/ |/| Fix sequence name with abstract classes.
| * Fix sequence name with abstract classes.Edgars Beigarts2011-12-041-2/+2
| |
* | moves some auto explain logic to the subscriber [José Valim & Xavier Noria]Xavier Noria2011-12-042-19/+12
| |
* | simplifies ActiveRecord::ExplainSubscriber [José Valim & Xavier Noria]Xavier Noria2011-12-041-8/+6
| |
* | Merge branch 'explain'Xavier Noria2011-12-045-55/+62
|\ \ | |/ |/|
| * implements a much faster auto EXPLAIN, closes #3843 [José Valim & Xavier Noria]Xavier Noria2011-12-045-55/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit vastly reduces the impact of auto explain logging when enabled, while keeping a negligible cost when disabled. The first implementation was based on the idea of subscribing to "sql.active_record" when needed, and unsubscribing once done. This is the idea behind AR::Relation#explain. Subscribe, collect, unsubscribe. But with the current implementation of notifications unsubscribing is costly, because it wipes an internal cache and that puts a penalty on the next event. So we are switching to an approach where a long-running subscriber is listening. Instead of collecting the queries with a closure in a dedicated subscriber, now we setup a thread local. If the feature is disabled by setting the threshold to nil, the subscriber will call a method that does nothing. That's totally cheap.
* | Refactor readonly attributes conditionalCarlos Antonio da Silva2011-12-041-1/+2
|/
* SQlite3 Bump Arun Agrawal2011-12-041-1/+1
|
* Fix #3837.Jon Leighton2011-12-031-11/+5
| | | | | We also need to time zone convert time zone aware attributes when accessed via read_attribute, not only when via direct access.
* removes the convenience instance version of AR::Base.silence_auto_explainXavier Noria2011-12-032-89/+79
| | | | | | | 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.
* Merge pull request #3820 from jaylevitt/nested_loading_through_assocJon Leighton2011-12-031-1/+1
|\ | | | | reintroduce patch from #726 to handle nested eager loading via associations
| * reintroduce patch from #726 to handle nested eager loading via associationsJay Levitt2011-11-301-1/+1
| |
* | Merge pull request #3833 from kennyj/fix_3678-3Jon Leighton2011-12-031-3/+8
|\ \ | | | | | | Use show create table (fix 3678: third time).
| * | Use show create table.kennyj2011-12-031-3/+8
| | |
* | | yield > block.callXavier Noria2011-12-021-3/+3
| | |
* | | two small details from the previous patchXavier Noria2011-12-021-1/+1
| | |
* | | implements AR::Base(.|#)silence_auto_explainXavier Noria2011-12-022-61/+91
| | |
* | | indentation fix warningArun Agrawal2011-12-021-1/+1
|/ /
* | revises some details in the previous explain patchXavier Noria2011-12-022-3/+3
| |
* | Revert "Roflscaling!" (for now)Jon Leighton2011-12-022-8/+11
| | | | | | | | | | | | | | | | This reverts commit f6b5046305d43c5f64bcb6fed0e44f7bca99a603. 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.)
* | implements automatic EXPLAIN logging for slow queriesXavier Noria2011-12-029-95/+214
| |
* | Fewer string allocations in attribute methodJon Leighton2011-12-011-4/+4
| |
* | Roflscaling!Jon Leighton2011-12-012-11/+8
| | | | | | | | | | Don't prefix the name with attribute_. Avoids a string allocation on read_attribute, which is a bit faster.
* | Create method with known identifier then alias into place.Jon Leighton2011-12-011-25/+21
| | | | | | | | | | | | | | | | 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.)
* | Remove some unnecessary code etcJon Leighton2011-12-012-26/+11
| |
* | Add test for read_attribute(:id) with non-standard PK.Jon Leighton2011-12-012-4/+18
| | | | | | | | | | | | | | | | 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.
* | Remove the need for type_cast_attribute.Jon Leighton2011-12-015-43/+52
| | | | | | | | This is good because it reduces duplication.
* | Get rid of the underscore versions of attribute methods!Jon Leighton2011-12-015-6/+35
| | | | | | | | This makes me happy!
* | Don't rely on underscore-prefixed attribute methods.Jon Leighton2011-12-013-48/+80
| | | | | | | | | | | | 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
* | Remove unnecessary *argsJon Leighton2011-12-011-2/+2
| |
* | Allow rescue responses to be configured through a railtie.José Valim2011-12-011-0/+7
| |
* | Add hackery to make Syck use encode_with/init_with. Fixes 1.8 after recent ↵Jon Leighton2011-12-011-0/+20
| | | | | | | | changes to attribute serialization.
* | If the table behind has no primary key, do not ask again and just return nil.Julius de Bruijn2011-11-301-1/+2
| |
* | consistencyJon Leighton2011-11-303-16/+16
| |
* | Don't check column type, you might implement a custom coder that serializes ↵Jon Leighton2011-11-301-1/+1
| | | | | | | | to a different type
* | omg computer science!Jon Leighton2011-11-303-24/+46
| | | | | | | | | | | | | | 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.
* | Don't need second paramJon Leighton2011-11-302-4/+4
| |
* | No longer need to undef id as we are defining it ourselvesJon Leighton2011-11-301-3/+0
| |
* | Move some serialization stuff out of BaseJon Leighton2011-11-302-40/+42
| |
* | Extract attribute serialization code into a separate moduleJon Leighton2011-11-304-28/+49
| |
* | Use inheritance to avoid special-case code for the 'id' methodJon Leighton2011-11-303-8/+20
| |
* | #id is an alias for whatever the primary key isJon Leighton2011-11-301-1/+1
| |
* | fix indentJon Leighton2011-11-301-3/+3
|/
* s/is is/isVijay Dev2011-12-011-1/+1
|
* Revert "Implement ArraySerializer and move old serialization API to a new ↵José Valim2011-11-302-4/+4
| | | | | | | | | | | | | namespace." This reverts commit 8896b4fdc8a543157cdf4dfc378607ebf6c10ab0. Conflicts: activemodel/lib/active_model.rb activemodel/lib/active_model/serializable.rb activemodel/lib/active_model/serializer.rb activemodel/test/cases/serializer_test.rb
* ActiveRecord::Relation#pluck methodBogdan Gusiev2011-11-303-2/+19
|
* push synchronization in to each method. Reduces method calls and makesAaron Patterson2011-11-291-25/+29
| | | | it clear which methods are synchronized.
* Automatic closure of connections in threads is deprecated. For exampleAaron Patterson2011-11-291-1/+7
| | | | | | | | | | | | | | | | | 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.