lib/neo4j/active_node/validations.rb in neo4j-5.2.15 vs lib/neo4j/active_node/validations.rb in neo4j-6.0.0.alpha.1
- old
+ new
@@ -35,13 +35,13 @@
conditions = scope_conditions(record)
# TODO: Added as find(:name => nil) throws error
value = '' if value.nil?
- conditions[attribute] = options[:case_sensitive] ? value : /^#{Regexp.escape(value.to_s)}$/i
+ conditions[attribute] = options[:case_sensitive] ? value : /#{Regexp.escape(value.to_s)}/i
found = record.class.as(:result).where(conditions)
- found = found.where('ID(result) <> {record_neo_id}').params(record_neo_id: record.neo_id) if record._persisted_obj
+ found = found.where_not(neo_id: record.neo_id) if record._persisted_obj
found
end
def message(instance)
super || 'has already been taken'