diff --git a/templates/bake/Template/view.twig b/templates/bake/Template/view.twig
index ae63d0e2..76192e48 100644
--- a/templates/bake/Template/view.twig
+++ b/templates/bake/Template/view.twig
@@ -118,7 +118,7 @@
{% endif %}
{% set relations = associations.BelongsToMany|merge(associations.HasMany) %}
{% for alias, details in relations %}
-{% set otherSingularVar = alias|variable %}
+{% set otherSingularVar = alias|singularize|variable %}
{% set otherPluralHumanName = details.controller|underscore|humanize %}
= __('Related {{ otherPluralHumanName }}') ?>
diff --git a/tests/comparisons/Template/testBakeView.php b/tests/comparisons/Template/testBakeView.php
index c206f54a..7e37823b 100644
--- a/tests/comparisons/Template/testBakeView.php
+++ b/tests/comparisons/Template/testBakeView.php
@@ -74,17 +74,17 @@
= __('Published') ?> |
= __('Actions') ?> |
- articles as $articles) : ?>
+ articles as $article) : ?>
- = h($articles->id) ?> |
- = h($articles->author_id) ?> |
- = h($articles->title) ?> |
- = h($articles->body) ?> |
- = h($articles->published) ?> |
+ = h($article->id) ?> |
+ = h($article->author_id) ?> |
+ = h($article->title) ?> |
+ = h($article->body) ?> |
+ = h($article->published) ?> |
- = $this->Html->link(__('View'), ['controller' => 'Articles', 'action' => 'view', $articles->id]) ?>
- = $this->Html->link(__('Edit'), ['controller' => 'Articles', 'action' => 'edit', $articles->id]) ?>
- = $this->Form->postLink(__('Delete'), ['controller' => 'Articles', 'action' => 'delete', $articles->id], ['confirm' => __('Are you sure you want to delete # {0}?', $articles->id)]) ?>
+ = $this->Html->link(__('View'), ['controller' => 'Articles', 'action' => 'view', $article->id]) ?>
+ = $this->Html->link(__('Edit'), ['controller' => 'Articles', 'action' => 'edit', $article->id]) ?>
+ = $this->Form->postLink(__('Delete'), ['controller' => 'Articles', 'action' => 'delete', $article->id], ['confirm' => __('Are you sure you want to delete # {0}?', $article->id)]) ?>
|