Rails' LogSubscriber has moved to ActiveSupport. See http://is.gd/d5BwH
This commit completely removes any IM related setup code from dm-rails. It's much more flexible to just rely on rails controller API that allows you to add any rack middleware for that controller only. So in order to enable the IM for any specific controller, you only need to make sure that the provided middleware is available by requiring it require 'dm-rails/middleware/identity_map' Then you can enable it by adding the following call in your controller's class. use Rails::DataMapper::Middleware::IdentityMap Obviously, if you want to enable the IM for all controllers by default, you can simply stick the above lines into application_controller.
This should ideally fix most of the reloading issues that previously occured mostly in development mode. The way it works now, is the following: Production mode: All models are required once on application bootup and all FK properties get initialized. Subsequent request won't reload the models. Development mode: All models are required once on application bootup and all FK properties get initialized. Subsequent requests will do the same before being processed.
This patch completely drops the use of the adapter cascade along with adapter wrappers. This will hopefully work around the problems with transactions and migrations, which both need real AbstractAdapter descendants to work. The previous adapter wrappers were'nt properly recognized which basically rendered transactions and migrations useless for the sake of being able to display some benchmarking information in rails' server logs. This patch should get around that by only extending the adapter behavior with our benchmarking needs, instead of wrapping it in a new object that's not a descendant of AbstractAdapter. Thx to Xavier Shay for the idea! In the hopefully not so longterm, the benchmarking mixin will go away anyway, because (at least) the DO adapters will provide useful benchmarking info by means of passing a struct containing the info to a Connection#log(info) method that's defined in ruby instead of only in the native driver implementations (as is the case currently).
This was made possible in http://is.gd/b0MA0 Previously the "toplevel" railtie config key was specified by railtie_name :data_mapper which forced us to put our custom configuration object into config.data_mapper.configuration
When STI is used for models the auto-require feature of active_support may require a parent model when requiring a child model before preload_models then requires the same parent model again causing the descendants of the parent to get corrupted and relationship properties in the children end up not getting defined correctly. Maybe this could get fixed in dm-core? Sounds like something weird is going on when STI related classes are required/loaded twice? To be honest, I don't exactly understand what's going on here, but Patrik confirms that this patch fixes / works around the STI issues.