Keenanp Keenanp - 6 months ago 11
Ruby Question

Discrepancy displaying product details - rails

I've been testing migrating new columns to my rails project. They should, ideally, display product info. However, when I select the sample product for details (show), the first three fields will display their info (description, image url, color), but not the clothing type or team name.

I don't think it's a migration issue, since those fields show their data properly in the product listing page, and the edit product form, and they are using the same ERB instance variable. (ex. they will show the team name in the products list but not viewing the product in detail)

Here's my show page. I don't see any console errors. I've checked my params, and they're fine, and like I said, the information is showing fine elsewhere. Thoughts? Thank you



<p id="notice"><%= notice %></p>

<p>
<strong>Name:</strong>
<%= @product.name %>
</p>

<p>
<strong>Description:</strong>
<%= @product.description %>
</p>

<p>
<strong>Image url:</strong>
<%= @product.image_url %>
</p>

<p>
<strong>Color:</strong>
<%= @product.color %>
</p>

<p>
<strong>Clothing Type</strong>
<% @product.clothing_type %>
</p>

<p>
<strong>Team Name</strong>
<% @product.team_name %>
</p>

<%= link_to 'Edit', edit_product_path(@product) %> |
<%= link_to 'Back', products_path %>





(edit: manners)

Answer

You have to put = sign to your ruby code. Like this <%=, if you want to display the result.