Database Reference
In-Depth Information
Figure 10-10. Adding a status update
The add_content route and add_content method are shown in Listing 10-32. When a new status update is
created, in addition to its graph id, the add_content method also generates a contentId, which performs using the
SecureRandom.uuid method.
Listing 10-32. add Route and save Method for a Status Update
# add a status update - route
post '/posts/add' do
contentItem = JSON.parse(request.body.read)
# save and return content
contentItem=add_content(neo,contentItem,request.cookies[graphstoryUserAuthKey])
json contentItem
end
The add_content method also makes the status the CURRENTPOST . determine whether a previous CURRENTPOST
exists and, if one does, change its relationship type to NEXTPOST . In addition, the tags connected to the status update
are merged into the graph and connected to the status update via the HAS relationship type.
 
Search WWH ::




Custom Search