Communities for your favorite technologies. Explore all Collectives
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I have the following code in my show view.
show
<p> <strong>Average difference:</strong> <%= @prediction.average_difference %> </p>
However, the field's value is not printed. What am I doing wrong?
Probably @average_difference attribute of @prediction is nil. In order to confirm that, you may write
@average_difference
@prediction
nil
<%= @prediction.average_difference || 'test_average_difference' %>
which should display test_average_difference.
test_average_difference
Add a comment
Fire up rails console to check @prediction.average_difference if it shows up a value their in console it must show the same in the view as well.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.