Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3397222
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:30:09+00:00 2026-05-18T04:30:09+00:00

I was expecting it to be the union of all changes between 2 versions.

  • 0

I was expecting it to be the union of all changes between 2 versions. (using vestal versions 1.0.2)

ruby-1.8.7-p174 > contact.version 
 => 12 
ruby-1.8.7-p174 > contact.latest_approved_version
 => 8 
ruby-1.8.7-p174 > contact.changes
 => {} 
ruby-1.8.7-p174 > contact.versions.last.changes
 => {"first_name"=>["I changed this one baby", "AdminF"]} 
ruby-1.8.7-p174 > contact.changes_between(8,12)
 => {} 
ruby-1.8.7-p174 > contact.changes_between(9,12)
 => {"deleted"=>[true, false]} 
ruby-1.8.7-p174 > contact.changes_between(10,12)
 => {} 
ruby-1.8.7-p174 > contact.changes_between(11,12)
 => {"first_name"=>["I changed this one baby", "AdminF"]} 

As you can see no changes between 8 and 12, but changes between some of them.

The weird thing is I swear this was working yesterday!

Here is the method vestal is using, im not sure what the problem is:

 def changes_between(from, to)
    from_number, to_number = versions.number_at(from), versions.number_at(to)
    return {} if from_number == to_number
    chain = versions.between(from_number, to_number).reject(&:initial?)
    return {} if chain.empty?

    backward = from_number > to_number
    backward ? chain.pop : chain.shift unless from_number == 1 || to_number == 1

    chain.inject({}) do |changes, version|
      changes.append_changes!(backward ? version.changes.reverse_changes : version.changes)
    end
  end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T04:30:09+00:00Added an answer on May 18, 2026 at 4:30 am

    It is possible that there is nothing wrong with the example you provided. If for example there are no differences between version 8 and 12. Even though there has been changes in version 9, 10 and 11, the method changes_between will not show any changes if the model’s attributes has been reverted to the same values.

    I think the easiest way to verify that is to check:

    >> contact.revert_to(8)
    => "8"
    >> contact.inspect
    => "#<Contact ... >"
    >> contact.revert_to(12)
    => "12"
    >> contact.inspect
    => "#<Contact ... >"
    

    And then compare the output. I can’t think of any other reason for the result you described.

    By the way, the call you made to “last_approved_version”, is that something you manually added to your model or is it something built-in in vestal_versions? Because I also use the 1.0.2 vestal_version and I can’t find any reference to that. So if it really is something built-in then we probably have different forks of vestal_version and that might be the cause…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is something I wasn't expecting. I'm using anemone to count links in pages
I always felt that expecting exceptions to be thrown on a regular basis and
I was expecting to find that section within System.Web.Configuration namespace just like other Web.config
I am not expecting a definite yes or no. Any knowledge you might have
I am expecting users to upload a CSV file of max size 1MB to
By design I'm expecting a DuplicateKeyExeception from time to time. Is it possible to
I was expecting the following code to throw an exception when I goto write
I was expecting the below scenario common, but couldn't find much help online. I
I am expecting when I go $.each($(something).find(something), function(){ $(this).delay(1000).fadeOut(); }); then for each matching
My IDE is expecting a semicolon but I'm not sure where! It is this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.