Displaying 1 result from an estimated 1 matches for "most_recent_price".
2006 Mar 10
2
adding to has_many on create and edit
...l is to be able to create a unit and set its price at the same
time. Then, when I update a unit, should I change the price, I want
to add a new row and time stamp to the price table.
My unit model looks like this:
-----------
class Unit < ActiveRecord::Base
has_many :prices
has_one :most_recent_price, :class_name => "Price", :order =>
''created_at DESC''
end
-----------
The has_one :most_recent_price lets me grab the most recent price for
display and comparison purposes.
I can currently accomplish my aims in the controller like so:
-----------
class AdminU...