Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBrad Givens
6,621 PointsActive record association
Really struggling with this challenge, the error message that appears seems indecipherable! I've tried various iterations and reviewed the video over again but I must still be missing something - any help would be amazing!
<h1>Owner: <%= @owner.name %></h1>
<div id="pets">
<h2>Pets</h2>
<%= @owner.name.each do |name| %>
<%= render partial: "pets/pet", locals: {pet: pet} %>
<% end %>
</div>
<div>
<strong>Name:</strong>
<%= name.content %>
</div>
1 Answer
Clayton Perszyk
Treehouse Moderator 48,850 PointsHey Brad,
You want to call each on pets attribute associated with @owner, not the name attribute. Then within the partial you need to access the name attribute for the pet. There is no content attribute.
Brad Givens
6,621 PointsBrad Givens
6,621 PointsHey Clayton,
Thanks for the reply! So within the partial it should ready <%= pet.name %> as opposed to <%= name.content %>?