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

Uninitialized constant error on require "active-model" #18

Closed
abhi18av opened this issue Dec 18, 2016 · 8 comments
Closed

Uninitialized constant error on require "active-model" #18

abhi18av opened this issue Dec 18, 2016 · 8 comments

Comments

@abhi18av
Copy link

abhi18av commented Dec 18, 2016

Hi again @topofocus

Hey, last night I installed Rails 5.0.0.1 and after that when I tried using the active-model gem, the repl throws the following error.

pry(main)> require 'active-orient'
NameError: uninitialized constant ActiveModel::Serializers::Xml
from /Users/eklavya/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/active-orient-0.42/lib/base.rb:10:in `<class:Base>'

I did google around and came across rails/rails#24558 apparently ActiveModel::Serializers::Xml has been removed from Rails5 but how dose all that related to active-orient is beyond me.

I've already tried installing

gem 'activemodel-serializers-xml'
gem 'active_model_serializers'

but that doesn't seem to solve the problem. Do you have any suggestions?

@abhi18av
Copy link
Author

abhi18av commented Dec 18, 2016

Oh, there's a workaround though

[2] pry(main)> require 'active-orient'
NameError: uninitialized constant ActiveModel::Serializers::Xml
from /Users/eklavya/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/active-orient-0.42/lib/base.rb:10:in `<class:Base>'
[3] pry(main)> require 'active_model/serializers'
=> true
[4] pry(main)> require 'active-orient'
=> true
[5] pry(main)>

Got this from rails/activemodel-serializers-xml#8

But I wonder why has this become a dependency of active-orient

@topofocus
Copy link
Owner

topofocus commented Dec 30, 2016

But I wonder why has this become a dependency of active-orient

That's because the model-records depend on several serializers:

module ActiveOrient
2 require 'active_model'
3
4 # Base class for tableless IB data Models, extends ActiveModel API
5
6 class Base
7 extend ActiveModel::Naming
8 extend ActiveModel::Callbacks
9 include ActiveModel::Validations
10 include ActiveModel::Serialization
11 include ActiveModel::Serializers::Xml
12 include ActiveModel::Serializers::JSON
13 include OrientDB

The base-class is able to process several import-formats.

Personal I use it to import API-Data from the Interactive-Brokers TWS.

@topofocus
Copy link
Owner

I just updated base.rb to fullfill the requirement-conditions.

@abhi18av
Copy link
Author

abhi18av commented Jan 1, 2017

Hi @topofocus

I just reinstalled the gem but apparently the issue persists. I've checked the version, it's the latest one from RubyGems.org - 0.42.

Happy new year 😄

@topofocus
Copy link
Owner

topofocus commented Jan 1, 2017 via email

@abhi18av
Copy link
Author

abhi18av commented Jan 1, 2017

Ah, right! Seems quite sensible ;)

@topofocus
Copy link
Owner

Closed after releasing of Gem Version 0.6

@abhi18av
Copy link
Author

Sure, it works :)

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

2 participants