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

adding orientdb serializable concern for models

parent 3bdea0b5
No related branches found
No related tags found
No related merge requests found
module OrientDbSerializable
extend ActiveSupport::Concern
include OrientDb::Methods::SanitizableMethods
def to_orientdb_hash
hash = {'@class' => self.class.to_s}
self.instance_variables.each do |var|
var_name = sanitize_orientdb_vars(var)
hash[var_name] = sanitize_orientdb_values(object.instance_variable_get(var))
end
hash.delete('id')
excluded_orientdb_properties.each do |property|
hash.delete(property.to_s)
end
# TODO: find a better way to ignore variables from ActiveModel
hash.delete("validation_context")
hash.delete("errors")
hash
end
def excluded_orientdb_properties; end
end
\ No newline at end of file
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