Closed alexandru-calinoiu closed 8 years ago
You need either start setup prior requiring your relation classes, or at least require rom-sql
manually yourself. Lemme know if that works. This should be better explained, probably a small standalone example would be best.
I still can't get it working, maybe I don't understand the role of relations. I've pushed the project I am working on here https://github.com/alexandru-calinoiu/rom-test
I am basically trying to get https://github.com/alexandru-calinoiu/rom-test/blob/master/spec/rom/test/repositories/posts_repo_spec.rb this spec to pass or at least run.
I guess what I am trying to achive is this part of the relations docs:
You can put them in separate files, namespace them or not, and configure them when it's needed
Found config.auto_registration
in ROM::Configuration
and tried to use that now the error is ROM::Registry::ElementNotFoundError: :posts doesn't exist in ROM::RelationRegistry registry
it still seems that he relation does not get picked up :(
@alexandru-calinoiu I'll set it up for you in a couple hours
Later ...
I finally figured this out, turns out the auto_registration
has some dirs that it searches for relations in.
Opened a pr to sequel in the mean time also https://github.com/jeremyevans/sequel/pull/1250 :)
It still does not feel right improvements are welcomed.
@alexandru-calinoiu yeah in 2.0.0 it needs (relations|commands|mappers)/**/*.rb
structure, but in 2.0.1 it's gonna be more flexible and configurable (it's already done in master)
OK so I'm gonna close this one. I'll add a simple setup example to the docs along with a repo on github, this should help in cases like yours.
Thanks, I believe that a slight improvement on this part of the docs will help a lot.
i had a similar issue like you @alexandru-calinoiu and i added in my repository relations :pots
Trying to learn more about rom so I am working through the guides in fresh ruby gem project. I can't seem to figure out how to define my relations in separate files.
I have a relation defined like this:
But of course when I require it in it fails with: 'Failed to find relation class for sql adapter. Make sure ROM setup was started and the adapter identifier is correct.'
Does this mean I have to have a finalized container before I try to load the file?