dynamic product price in Rails
<p>I have:</p>

<pre><code>scaffold Book name price:integer
scaffold Sale book:referenes quantity:integer
</code></pre>

<p>Book.rb</p>

<pre><code>has_many :sales
</code></pre>

<p>Sale.rb:</p>

<pre><code>belongs_to :book

def total
  book.price * quantity.to_f
end
</code></pre>

<p><strong>Problem</strong>: If I want to change the price of a book, it will recalculate all the past sales. </p>

<p>Can I avoid this? By somehow saving the pricing history of a product or having a current_price (active price)?</p>