# avoids mass-assignment restriction for protected attributes def update_from_hash!(params) params.each {|method,value| self.send("#{method}=", value)} self end