I have a ProductsColor
model. Given a params hash, is there a way to set an existing record's attributes with one method without saving it? Similar to how ProductsColor.new(params)
would instantiate an object and set its attribute to the ones in the params
hash, I want to set attributes of an existing record without saving it like so:
params = {name: "hey"}
p = ProductsColor.find(1)
p.something(params) # does not save to the database, but does set the value of the params to p in memory
p.name # "hey"
p.save # <-- now it saves permanently