Rails - Vestal Versions - Access previous version data w/o restoring?

Posted by AnApprentice on Stack Overflow See other posts from Stack Overflow or by AnApprentice
Published on 2010-12-24T22:36:39Z Indexed on 2010/12/24 22:54 UTC
Read the original article Hit count: 273

Hello, I'd like to use vestal versions to do the following:

  1. Determine the Content of the current record being saved
  2. Determine the Content of the last record saved

In my model I have:

class Note < ActiveRecord::Base
  versioned :if => :really_create_a_version?
  def really_create_a_version?
    XXXXXXXXXXXXXX
    XXXXXXXXXXXXXX
  end
end

Where the XXXX are, how can I get the note.content of the item about to be saved (i'm assuming it hasn't been saved yet to the DB? Is that correct?

Also, how can I get the note.content of the save before the current save in progress?

Thanks

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby-on-rails3