Sha256: c7f96e5100dd0cf241e80886a7536fdcb8c53279ad2a659f4203e6c130db59ec

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

Make Activerecord Observers not load observed models -> faster/safer environment boot.
 - faster tests + console
 - able to boot environment without/with empty/with old database

Works on rails 2.3 + 3.0 (not yet 3.2)

Install
=======

    gem install lazy_observers

Usage
=====

    class FooObserver < ActiveRecord::Observer
      lazy_observe "User", "Foo::Bar"

      ...
    end

### Extend models from gems after they are loaded

    LazyObservers.on_load("Arturo::Feature") do |klass|
      Arturo::Feature.class_eval do
        ... funky hacks ...
      end
    end

### Catch models that are loaded in application startup.

    LazyObservers.debug_active_record_loading

`script/console` or `rails c`

### Verify you did not misspell
Loads all classes registered via observers, to make sure you did not misspell</br>
(negates the effect of lazyness, so only use for debugging)


    LazyObservers.check_classes


# TODO
 - Rails 3.0: does not work for models that are loaded before the observers
 - Rails 3.2: blows up

Author
======
[Michael Grosser](http://grosser.it)<br/>
michael@grosser.it<br/>
License: MIT<br/>
[![Build Status](https://secure.travis-ci.org/grosser/lazy_observers.png)](http://travis-ci.org/grosser/lazy_observers)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lazy_observers-0.0.2 Readme.md