Review

Think about passing data into a partial as a local variable. If you do that, the partial needs less knowledge of, and is more decoupled from, the containing template. This particular partial as it is now can only be used in a controller/view that sets a @dogs parameter. But its only concern is with displaying messages. If you passed in "@dog.messages" from the container as a local called, e.g. messages, then your partial would just do "for message in messages" and not need to know anything about dogs.