Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot be used __without__ rom #3

Open
kwando opened this issue Oct 26, 2015 · 12 comments
Open

Cannot be used __without__ rom #3

kwando opened this issue Oct 26, 2015 · 12 comments

Comments

@kwando
Copy link

kwando commented Oct 26, 2015

rom-model depends on rom, or more specifically the rom/constants file which exists in rom gem.

@solnic
Copy link
Member

solnic commented Oct 26, 2015

Which ones?

@d-Pixie
Copy link

d-Pixie commented Mar 29, 2016

If you follow the example in lib/rom/model/attributes.rb and try to use rom-model by mixing in ROM::Model::Attributes you get this error:

/Users/pixie/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rom-model-0.2.0/lib/rom/model/validator.rb:5:in `require': cannot load such file -- rom/constants (LoadError)
from /Users/pixie/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rom-model-0.2.0/lib/rom/model/validator.rb:5:in `<top (required)>'
from /Users/pixie/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rom-model-0.2.0/lib/rom/model.rb:2:in `require'
from /Users/pixie/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rom-model-0.2.0/lib/rom/model.rb:2:in `<top (required)>'
from /Users/pixie/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rom-model-0.2.0/lib/rom-model.rb:1:in `require'
from /Users/pixie/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rom-model-0.2.0/lib/rom-model.rb:1:in `<top (required)>'
from /Users/pixie/projects/fortnox-api/lib/fortnox/api/models/invoice.rb:5:in `require'
    ...

The project at this point only includes rom-model not the rom gem.

Either make the dependency explicit by adding the rom gem as a dep. to rom-model or, better for standalone use, remove the dependency or refactor it out into something a bit more lightweight to include than rom :)

@d-Pixie
Copy link

d-Pixie commented Mar 29, 2016

@solnic ping me if you need any further info.

@solnic
Copy link
Member

solnic commented Mar 29, 2016

Seems like we're missing require "rom/constants" which is actually provided by rom-support which this gem does depend on.

@d-Pixie
Copy link

d-Pixie commented Mar 29, 2016

Also given that I get the following errors when adding rom as a dependency to the project to solve the above error:

/Users/pixie/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rom-0.8.1/lib/rom/constants.rb:3: warning: already initialized constant ROM::Undefined
/Users/pixie/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rom-support-1.0.0/lib/rom/support/constants.rb:2: warning: previous definition of Undefined was here
/Users/pixie/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rom-0.8.1/lib/rom/constants.rb:41: warning: already initialized constant ROM::EMPTY_ARRAY
/Users/pixie/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rom-support-1.0.0/lib/rom/support/constants.rb:4: warning: previous definition of EMPTY_ARRAY was here
/Users/pixie/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rom-0.8.1/lib/rom/constants.rb:42: warning: already initialized constant ROM::EMPTY_HASH
/Users/pixie/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rom-support-1.0.0/lib/rom/support/constants.rb:3: warning: previous definition of EMPTY_HASH was here

I think the errors is as simple as that the require 'rom/constants' line in lib/rom/model/validator.rb:5 should really be require 'rom-support/constants' instead.

@solnic
Copy link
Member

solnic commented Mar 29, 2016

Sorry, I meant require "rom/support/constants".

@d-Pixie
Copy link

d-Pixie commented Mar 29, 2016

Ah, well, path smath :) Want a PR or will you fix it?

@solnic
Copy link
Member

solnic commented Mar 29, 2016

PR would be awesome :)

@solnic
Copy link
Member

solnic commented Mar 29, 2016

@d-Pixie
Copy link

d-Pixie commented Mar 29, 2016

@solnic while fixing the above error I get the same problem a few lines further down for require 'rom/pipeline' that is used when creating the Pipeline class. This seem to actually be in the rom gem :/

How would you want me to handle that? One choice is to migrate that out into the support gem as well, but that is a series of PRs in that case.

@d-Pixie
Copy link

d-Pixie commented Mar 29, 2016

Ah, just read the future plans section. Might not be worth fixing then :) I'll have a look at the suggested replacements instead.

@solnic
Copy link
Member

solnic commented Mar 29, 2016

Sorry for the confusion. This gem was extracted from rom-rails but I stopped using rails and anything with Active* prefix, so I have no reason to maintain this one anymore :/ As mentioned in README, we may need some sort of integration between dry-validation and rom, so maybe rom-model would become that. We'll see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants