Callbacks for the Machinist

We like Machinist a lot. Unfortunately there are record construction rules cannot be expressed with a Machinist blueprint, for instance:

  • Creating a record with a has_many association already filled in.
  • Creating a record with interdependencies between associated objects, such as having to belong to the same container.
  • Needing to process a delayed_job queue after record construction.

We just released machinist_callbacks to fix that. This gem provides before_make and after_make callbacks, allowing you to write a blueprint like this:

Director.blueprint do
  name
  after_make { movies << Movie.make }
end

Check out machinist_callbacks on Github.

You can follow any response to this post through the Atom feed.

Avatar

Sun, 20 Jun 2010 12:17:00 GMT

by henning

Tags:

Leave a comment