I’m new to Rails…using RubyMine as an IDE.
I have Paper_Trail saving previous versions of the data “xoi_qb”. My
view is currently showing the current and previous data as I’d like, but
I would like to show the diff between the current version “xoi_qb” and
the previous version “xoi_qb”. For instance, the current version may be
“97” and the previous version may be “94”, and I would like to display
“+3”. I would like to display this difference and add the “+” or “-”
based on the positive or negative change.
In my model, Paper Trail is set to create versions like this:
xoi_qb = [ ]
self.versions.each do |version|
xoi_qb << version.reify.xoi_qb
And in my HTML set to display the versions like this:
|<%= version.reify.xoi_qb %> dated <%= version.created_at %>|