lib/neo4j/active_node/has_n.rb in neo4j-6.0.0.alpha.3 vs lib/neo4j/active_node/has_n.rb in neo4j-6.0.0.alpha.4
- old
+ new
@@ -370,11 +370,11 @@
association_proxy(name).pluck(:neo_id)
end
end
def define_method_unless_defined(method_name, &block)
- define_method(method_name, block) unless respond_to?(method_name)
+ define_method(method_name, block) unless method_defined?(method_name)
end
def define_has_one_methods(name)
define_has_one_getter(name)
@@ -386,18 +386,18 @@
association_proxy(name, {node: node, rel: rel, labels: options[:labels]}.merge!(options))
end
end
def define_has_one_id_methods(name)
- define_method("#{name}_id") do
+ define_method_unless_defined("#{name}_id") do
association_proxy(name).result_ids.first
end
define_method_unless_defined("#{name}_id=") do |id|
association_proxy(name).replace_with(id)
end
- define_method("#{name}_neo_id") do
+ define_method_unless_defined("#{name}_neo_id") do
association_proxy(name).pluck(:neo_id).first
end
end
def define_has_one_getter(name)