I am showing some properties of an ActiveRecord::Base called Micropost:
<table>
<tr>
<th>Items</th>
<th>Creation Date</th>
<th>Progress</th>
</tr>
<td>
<% @user.microposts.each do |micropost| %>
<tr>
<td><%= micropost.content %></td>
<td><%= micropost.created_at %></td>
<td><%= micropost.progress %></td>
</tr>
<% end %>
</td>
</table>
This is the class definition:
class Micropost < ActiveRecord::Base
belongs_to :user
validates :content, length: { maximum: 140 }
@progess = 0
end
It works fine if I don't put the <td><%= micropost.progress %></td>. However, if I do I get a:
undefined methodprogress' for #`
I have also tried progress :number but I can't quite seem to find out how I can add a variable to that class and display it on my .erb.