The method last
could take an argument. If you call last(2)
you get the 2 latest elements, so doing last(2).first
you will get the second latest element.
@schedule = Schedule.last
@latest_version_model = @schedule.versions.last
@2nd_to_latest_version_of_model = @schedule.versions.last(2).first