Setting nil values in Machinist blueprints

Posted . Visible to the public.

Take care when trying to set attributes to nil in a blueprint.

Given the following master blueprint:
Story.blueprint do
title
author { User.make }
editor { User.make }
end

This approach will not overwrite/remove the editor defined in the master blueprint:
Story.blueprint(:draft) do
editor nil
end

...whereas this one will (note the lambda):
Story.blueprint(:draft) do
editor { nil }
end

Arne Hartherz
Last edit
License
Source code in this card is licensed under the MIT License.
Posted by Arne Hartherz to makandra dev (2010-10-13 13:18)