I have a model called userWorkshop it references both a User and a Workshop.
Workshops have a price column.
userWorkshops have an override_price column.
I would like its default value of the override_price column of the UserWorkShop to be based on the price column of the Workshop it is associated with.
I want to set this value in my ActiveRecord migration. I imagine it might look something like this:
def change
add_column :userWorkshops, :override_price, :float, default: "self.workshop.price"
end
Any idea on the correct way to do this?