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

string shouldn't be automatically converted to ruby-symbol #48

Closed
Enceradeira opened this issue Jul 17, 2012 · 1 comment
Closed

string shouldn't be automatically converted to ruby-symbol #48

Enceradeira opened this issue Jul 17, 2012 · 1 comment

Comments

@Enceradeira
Copy link

Following tests fails

describe Neography do
  subject { Neography::Rest.new({:port => 7475, :log_enabled => false}) }
  describe 'create_node' do
    it 'should not convert strings to symbol' do
      node = subject.create_node({:text => ':1456'})

      node['data']['text'].class.should == String # fails! expected: String got: Symbol (using ==)
      node['data']['text'].should == ':1456'
    end
  end
end

The string is correctly stored as ':1456' in the database, but I expect it to be returned as a string and not to be converted to a ruby-symbol. I analyzed it on get_node() and I saw that the Oj-library is doing the deserialization but I couldn't see how I could override that behaviour easily.

How could I change that behaviour? Shouldn't neography always return strings?

Cheers
Jorg

@maxdemarzi
Copy link
Owner

The default conversion mode for OJ is :object which is causing that problem.

I have changed it to use strict mode.

Oj.default_options = { :mode => :strict }

Thanks for reporting this!

willkessler pushed a commit to willkessler/neography that referenced this issue Apr 21, 2014
Adding Batch Support And Count Method to Deja
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