I am trying to make a list of versions using Paper trail, this user will be able to see the difference between the versions and return to the old version.
I learned how to list and link to this version, but for some reason I get an error when I try to confirm the last two versions. It says: undefined `reify 'method for nil: NilClass
Does anyone know what to do with this, and what to do with the diff version?
def edit
@page = Page.find(params[:id])
@versions = @page.versions
@page = @page.versions[params[:version].to_i].reify if params[:version]
end
class Page < ActiveRecord::Base
validates :title, :presence => true
belongs_to :category
has_paper_trail
end
<% @versions.each do |version| %>
<ul>
<li><%= version.id %> <%= link_to "Previous version", {:version => (version) }%></li>
</ul>
<% end %>
<%= link_to "Go to current version"%>
thanks for the help
source
share