Module: Hibiki::Rails::Generators::ScaffoldParentInjection

Included in:
ScaffoldControllerGenerator
Defined in:
lib/generators/hibiki/rails/scaffold_parent_injection.rb

Overview

What the scaffold writes into the model a belongs_to points AT — the second file the app already owned, and the one Rails' own scaffold never touches at all.

Two things, and each fixes a failure the child's own injection cannot reach. The has_many, because author:references writes only the belongs_to half: without it the first author.destroy! raises InvalidForeignKey, from a destroy button THIS generator emitted. And the ping, because a row prints the PARENT's label rather than its id — so a rename leaves every open index printing the old one until something happens to write a child.

Both names come from a reflection rather than from this generator's own argument, which is why they live here and not in ScaffoldModelInjection. Reports its outcomes rather than printing them: ScaffoldParentNotices turns them into the lines the user reads.