Posted over 4 years ago. Visible to the public.

Machinist blueprints: Do not set associations without blocks

TL;DR In blueprints, always wrap associations in blocks.

Copy
# Broken Task.blueprint(:vacation) do project Project.make(:vacation) hours 8 accounting_method 'none' end
Copy
# Correct Task.blueprint(:vacation) do project { Project.make(:vacation) } hours 8 accounting_method 'none' end

Without the block, Project.make will only run once when the blueprint is parsed (usually when RSpec is loaded), which is not what you want.

Once an application no longer requires constant development, it needs periodic maintenance for stable and secure operation. makandra offers monthly maintenance contracts that let you focus on your business while we make sure the lights stay on.

Owner of this card:

Avatar
Dominik Schöler
Last edit:
1 day ago
by Andreas Herz
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Dominik Schöler to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more