lib/neo4j/active_node/orm_adapter.rb in neo4j-4.1.5 vs lib/neo4j/active_node/orm_adapter.rb in neo4j-5.0.0.rc.1
- old
+ new
@@ -26,11 +26,11 @@
end
end
# Get an instance by id of the model
def get(id)
- klass.find(wrap_key(id))
+ klass.find_by(klass.id_property_name => wrap_key(id))
end
# Find the first instance matching conditions
def find_first(options = {})
conditions, order = extract_conditions!(options)
@@ -70,12 +70,13 @@
def hasherize_order(order)
(order || []).map { |clause| Hash[*clause] }
end
def extract_id!(conditions)
- if id = conditions.delete(:id)
- conditions[klass.id_property_name.to_sym] = id
- end
+ id = conditions.delete(:id)
+ return if not id
+
+ conditions[klass.id_property_name.to_sym] = id
end
end
end
end