I'm trying to implement something similar to a historical price chart,
where I save the prices when they change to a "stats" table.

I'd like to take the current value and save it to a statistics model
before it gets updated with the new value.

Is there a way to do it with a trigger or should I just save the value
in two different models?

Something like this:


@book = Book.find(params[:id])
@stats = Stat.new()

puts @book.price #=> $10.00

@stats.book_id = @book.id
@stats.price = @book.price

@book.price = $20.00

@book.save()
@stats.save()
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to