ClassMethods¶
Constants¶
Methods¶
#find_by_id
def find_by_id(id) all.where(id_property_name => id).first end
#find_by_ids
def find_by_ids(ids) all.where(id_property_name => ids).to_a end
#find_by_neo_id
def find_by_neo_id(id) Neo4j::Node.load(id) end
- #has_id_property?
rubocop:disable Style/PredicateName
def has_id_property? ActiveSupport::Deprecation.warn 'has_id_property? is deprecated and may be removed from future releases, use id_property? instead.', caller id_property? end
#id_property
def id_property(name, conf = {}) self.manual_id_property = true Neo4j::Session.on_next_session_available do |_| @id_property_info = {name: name, type: conf} TypeMethods.define_id_methods(self, name, conf) constraint(name, type: :unique) unless conf[:constraint] == false end end
- #id_property?
rubocop:enable Style/PredicateName
def id_property? id_property_info && !id_property_info.empty? end
#id_property_info
def id_property_info @id_property_info ||= {} end
#id_property_name
def id_property_name id_property_info[:name] end
- #manual_id_property
Returns the value of attribute manual_id_property
def manual_id_property @manual_id_property end
- #manual_id_property=
Sets the attribute manual_id_property
def manual_id_property=(value) @manual_id_property = value end
#manual_id_property?
def manual_id_property? !!manual_id_property end
#primary_key
def id_property_name id_property_info[:name] end