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:
parent
1b3a2185eb
commit
0d42285496
1 changed files with 4 additions and 4 deletions
|
|
@ -2,9 +2,9 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
#this module attempts to be what you need to mix into
|
#this module attempts to be what you need to mix into
|
||||||
# base level federation objects that are not relayable, and not persistable
|
# base level federation objects that are not relayable, and not persistable
|
||||||
#assumes there is an author, author_id, id,
|
#assumes there is an author, author_id, id,
|
||||||
module Diaspora
|
module Diaspora
|
||||||
module Federated
|
module Federated
|
||||||
module Shareable
|
module Shareable
|
||||||
|
|
@ -85,7 +85,7 @@ module Diaspora
|
||||||
known_shareable = user.find_visible_shareable_by_id(self.class.base_class, self.guid, :key => :guid)
|
known_shareable = user.find_visible_shareable_by_id(self.class.base_class, self.guid, :key => :guid)
|
||||||
if known_shareable
|
if known_shareable
|
||||||
if known_shareable.mutable?
|
if known_shareable.mutable?
|
||||||
known_shareable.update_attributes(self.attributes)
|
known_shareable.update_attributes(self.attributes.except("id"))
|
||||||
true
|
true
|
||||||
else
|
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}")
|
Rails.logger.info("event=receive payload_type=#{self.class} update=true status=abort sender=#{self.diaspora_handle} reason=immutable") #existing_shareable=#{known_shareable.id}")
|
||||||
|
|
@ -113,4 +113,4 @@ module Diaspora
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue