How to reference a model instance at a given point of time in rails? -
i creating two-sided rental platform, owner sets price product freely. whenever renter creates booking, need lock in snapshot of product
model sensitive information pricing
locked in rental. 1 thing tried storing every information again @ rental
model, seems vulnerable future changes , updates.
is there better way overcome problem?
--- edit, make more specific ---
so in products table:
def change create_table :products |t| t.integer :hourly_rate t.integer :daily_rate end end
and in rental_requests table, need have similar columns.
def change create_table :rental_requests |t| t.integer :hourly_rate t.integer :daily_rate end end
which may cause problems when have update columns in product, means have update both tables.
your product can have many prices, , expose price
method returns latest price. rental can belong price.
Comments
Post a Comment