rails/rails — pull request #14469 by tiegz (2014-03-24 21:18:08+00:00)
Title: Swap Timestamp/Callbacks inheritance order in ActiveRecord::Base

### BUG

In Rails 3.2, the lookup order for `ActiveRecord::Base`'s `update`/`create` was found in this `include ...` order:

``` ruby
Callbacks -> Timestamp -> Dirty -> Optimistic -> Persistence
```

In Rails 4 (up thru 4.0.4, and 4.1.0.rc1), the lookup order for the equivalent methods `update_record`/`create_record` became:

``` ruby
Timestamp -> Callbacks -> Dirty -> Optimistic -> Persistence
```

As a result, now in Rails4 you can't do things like alter `record_timestamp` in callbacks ([example](https://gist.github.com/tiegz/9748836)). Plus, it seems like `Callbacks` should always be called first in the method chain?

### TESTS?

I didn't write tests because they pass with-and-without the fix, and not sure if it's worth it?

### REGRESSION

I think this was introduced in [this commit](https://github.com/rails/rails/commit/e030f26ad3de98205edec9d8b59ecca9508cb57d#diff-fdf28ad95ab439f8e95e8a32a59e58a8L61). It made the understandable mistake that `include A, B, C` will include the modules in FIFO order (`A,B,C`), but ruby actually includes them in FILO order (`C,B,A`).

Note that there are a few other modules that were `include`'ed in the reverse order in that commit. I haven't looked into any similar method classes in those modules though.