Skip to content
Snippets Groups Projects
Commit 8c433a6d authored by Mauricio Giacomini Girardello's avatar Mauricio Giacomini Girardello
Browse files

creating bookmarks collection for each user

parent ba5307e3
No related branches found
No related tags found
No related merge requests found
class Bookmarks < Collection
def name
'Bookmarks'
end
def name=(name)
raise 'Bookmarks can`t change the name.'
end
end
......@@ -50,12 +50,16 @@ class OrientDb::Base
hash = {}
hash["@class"] = odb_class
object.instance_variables.each do |var|
var_name = var.to_s.gsub(/\A@/, "")
var_name = sanitize_orientdb_vars(var)
hash[var_name] = object.instance_variable_get(var)
end
hash
end
def sanitize_orientdb_vars(var)
var.to_s.gsub(/\A@/, "")
end
def build_object(args={})
raise NoMethodError, "You must implement this method"
end
......
......@@ -9,6 +9,14 @@ module OrientDb
)
end
def create_bookmarks_collection(user)
bookmarks = Bookmarks.new(owner: user)
if !has_bookmarks?(user)
create bookmarks
end
end
private
def odb_class
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment