# Assuming you have a model called `Product` with a column named `price`
# Step 1: Make a change to the record
product = Product.find(1)
product.update(price: 20)
# Step 2: Check if the attribute 'price' has been changed
if product.saved_change_to_price?
# Step 3: Access the previous value of the 'price' attribute
previous_price = product.saved_change_to_price.first
puts "Previous price: #{previous_price}"
# Step 4: Access the current value of the 'price' attribute
current_price = product.saved_change_to_price.last
puts "Current price: #{current_price}"
end