Do not update_attributes with a nil id

Rails 4 accepts that as a parameter thus setting the id to nil
thus thinking it'd be a new record when we just want to update
it
This commit is contained in:
Jonne Haß 2014-02-10 01:19:21 +01:00
parent 1b3a2185eb
commit 0d42285496

View file

@ -85,7 +85,7 @@ module Diaspora
known_shareable = user.find_visible_shareable_by_id(self.class.base_class, self.guid, :key => :guid)
if known_shareable
if known_shareable.mutable?
known_shareable.update_attributes(self.attributes)
known_shareable.update_attributes(self.attributes.except("id"))
true
else
Rails.logger.info("event=receive payload_type=#{self.class} update=true status=abort sender=#{self.diaspora_handle} reason=immutable") #existing_shareable=#{known_shareable.id}")