I'm following the RailsTutorial, and I'm currently stuck on exercise 10.5.5. Since I'm changing quite a bit, I've put the code into a paste (updated).

There are a few things to note before going into the paste:

One of the original partials receives a collection from it's "parent" partial, while the other receives the object directly from the controller.

The if statement in both of these "child" partials uses a different object name, but they're represent the same object in the database.

Ideally, I'd like to move the if statement into the grandchild, or sub-sub-, partial. I can leave it in the child partial if need be, but this doesn't feel DRY.

I've tried rendering the grandchild partial with <%= render partial: 'shared/foo', object: bar, as: :baz %> so I can use baz in the grandchild partial, since the other child partial uses baz by default. In that partial, I'm just doing <%= render partial: 'shared/foo', object: baz %>. Confused? Me, too.

You'll notice I've tried rendering the partials both with and without passing in the parent object. Maybe the parent object needs to be redefine? I also just tried <%= render partial: 'shared/micropost_delete_link', object: feed_item %>, but no luck.