Commits on Aug 7, 2009
  1. [#5] Do nothing in terms of reciprocal setting if we are presented wi…

    …th something that's not an ActiveRecord::Base object.
    committed Aug 7, 2009
Commits on Aug 6, 2009
  1. Get around some autoloading issues when using activerecord on it's own.

    We need to refer to ActiveRecord::ActiveRecordError before we refer to ActiveRecord::Associations because of some autoload issues.  See https://rails.lighthouseapp.com/projects/8994/tickets/2577 for more details.
    committed Aug 6, 2009
Commits on Jul 28, 2009
  1. [#1] Support for setting reciprocals on direct assignment of has_one/…

    …belongs_to.
    
    Use replace as it gets called for build and create (and create! on has_one) as well as being what <association_name>= will use.  For has_one we still need to override new_record as it can be called with replace_existing = false, and thus replace won't be called.  Have optimised for that though.
    committed Jul 28, 2009
  2. Make use of set_XXXXX_target method that gets defined by association …

    …macros instead of doing it manually in set_reciprocal_instance.
    committed Jul 28, 2009
  3. Refactor has_many to do the reciprocal setting in one place.

    This also has the advantage of setting reciprocals on objects added to the array of associated objects via << (or push, or concat).
    committed Jul 28, 2009
  4. Make it work via the create! method for has_one associations.

    This involves a refactoring to make it work wihout overriding all 3 methods (build, create, create!).
    committed Jul 28, 2009
  5. [#4] Trap NameError's that occur when using reflection.klass on polym…

    …orphics
    
    The plugin still doesn't add any reciprocals for polymorphic associations, but it won't throw a NameError when trying to load a polymorphic association.  Generally speaking the .klass of a polymorphic association isn't actually a ruby class, just a convenient name to refer to all the types of object that can be associated with that model.
    committed Jul 28, 2009
Commits on Jul 27, 2009
  1. Rename internals to be consistent with the published name; parental_c…

    …ontrol, not self_control.
    committed Jul 27, 2009
  2. [#2] Support block-style building in has_many

    Pass through any supplied blocks for build and create in has_many associations so that the block-style stuff still works.  Not actually sure that has_one / belongs_to actually support this, so I've not done the same there.
    committed Jul 27, 2009
Commits on Nov 11, 2008
  1. Fixing a typo where I was still referring to the plugin by the origin…

    …al name self_control instead of parental_control
    committed Nov 11, 2008
  2. Big reworking of how candidates for recipricolness are found.

    Having to dig much deeper into rails internals now to know about how associations and their proxies are stored in the model and set them correctly when they are nil.  Also we have instance.is_a? instead of simple class equality to allow for STI type stuff going on.
    committed Nov 11, 2008
Commits on Sep 29, 2008
  1. If one model is has_manied to multiple other models and they had the …

    …same association name (and why wouldn't they) the first association to be called would be the only one you could use without causing a type mismatch error because of the caching we did not being specific enough.
    
    E.g.
    
    Bone.belongs_to :dog
    Bone.belongs_to :skeleton
    Dog.has_many :bones
    Skeleton.has_many :bones
    
    If we started with Bone and asked for dog then asked for skeleton, we'd get a mismatch on trying to set a Skeleton into the Dog.  We now make sure the reflection name and the instance class are used to cache the found association.
    committed Sep 29, 2008
Commits on Sep 12, 2008
Commits on Sep 10, 2008
  1. Fixed typo in README.

    committed Sep 10, 2008
Commits on Sep 8, 2008
  1. First commit, pulled (without the anaesthetic of git-svn) from our wo…

    …rk svn repo.
    
    It's far from complete, or comprehensively tested.  But we can sort that out over time.
    committed Sep 8, 2008