Read more

Setting nil values in Machinist blueprints

Arne Hartherz
October 13, 2010Software engineer at makandra GmbH

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

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

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

Posted by Arne Hartherz to makandra dev (2010-10-13 15:18)