Feeds:
Posts
Comments

Archive for the ‘classy-inheritance’ Category

Classy Inheritance

So depends_on graduated to a project called Classy Inheritance. Why the name difference? Well depends_on represents just one type of relationship. I expect other relationships to be added as needs arise. One such method I could see is “composed_of”, where the object wouldn’t be required.
Lockdown will be using Classy Inheritance for [...]

Read Full Post »

depends_on update(2)

This update allows for non-polymorphic associations. For instance a user belongs_to a profile. To define this association add the following to the User model:
depends_on :profile, :attrs => [:first_name, :last_name, :email]
Notice an “:as” option has not been passed because this isn’t a polymorphic association. So instead of adding the has_one call, a belongs_to [...]

Read Full Post »

depends_on update

I’ve updated the code for depends_on.
This update adds a dynamic method, so if you had the call:
depends_on :content, :attrs => [:name, :url ], :as => :presentable
Then you would get a “find_with_content” class method that does the :include for you.

Read Full Post »

depends_on

For one of my projects I had the need for a polymorphic association in which one object required the existence of the other. I had written a specific version of this, but decided it could easily be abstracted. I didn’t go with the built in ActiveRecord polymorphic features as I wanted to strip [...]

Read Full Post »