Skip to content

Instantly share code, notes, and snippets.

@jashkenas
Created May 20, 2009 16:14
Show Gist options
  • Save jashkenas/114916 to your computer and use it in GitHub Desktop.
Save jashkenas/114916 to your computer and use it in GitHub Desktop.
# This method will be called on any create or update, and should be the central
# clearing house for data processing and conversion.
def request_update_attributes(data, user=User.current, instance_id=ZenbeInstance.current)
instance_id ||= 'NO_INSTANCE_ID'
return false unless self.accessible_to?(user)
self.process_files(data)
self.process_embedded_urls(data)
self.update_attributes(data)
self.set_post_type
self.try_to_scribd_attachments
self.broadcast(User.current, ZenbeInstance.current, {
"channels" => [{"id" => self.channel.uuid, "name" => self.channel.name, "updated_at" => Time.now.utc}],
"posts" => [self.json_ready_hash]
})
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment