I have an action that saves new procucts like this:
@products = Product.new(params[:product])
@products.save
I am calling the same action for editing a product as well. But each time I edit...a new product gets created (because of above statements).
A while back I had seen some function that will only create a new record if there isn't an exising record. create_or_update
something like that. I can not find it now.
Can anyone tell me what the method was? or give me a better approach to do this?