I have this class
class RelatedExternalDe
include Neo4j::ActiveNode
property :eid
property :name
property :source
validates :eid, presence: true
has_many :in, :related_data_elements, type: 'related_external_de', model_class: RelatedDataElement, unique: true
end
then in the controller I retrieve the nodes. The nodes are retrieved correctly because they are displaying in view correctly.
The controller code is:
@external_data_elements = RelatedExternalDe.search(params[:search])
@external_data_elements.each do |external_de|
external_de.related_data_elements
end
I get the following error: undefined method `related_data_elements' for # RelatedExternalDe:0x007fefa4fd6b78>
I tried using RelatedExternalDe.find_by instead of running the query and I get the same outcome. Now, if I created an object with new "RelatedExternalDe.new" everything seems to work. Any ideas what I am doing wrong?