Open dblock opened 10 years ago
rabl does work on Jruby, only the OJ gem is MRI only, it uses native C extensions.
in Jruby and mongoid without OJ gem, we get
{"id"=>{"$oid"=>"53a1506ff12a9c47ba000e29"}}
instead of
{"id"=>"53a1506ff12a9c47ba000e29"}
we can also use this in the rabl files, but it's kind of a pain in the ass to do it.
node(:id) {|obj| obj.id.to_s }
This has been discussed in https://groups.google.com/forum/#!msg/mongoid/MaXFVw7D_4s/T3sl6Flg428J.
Monkey patch:
module BSON
class ObjectId
def as_json(options = {})
to_s
end
def to_bson_key(encoded = ''.force_encoding(BINARY))
to_s.to_bson_key(encoded)
end
end
end
@fred How does Rabl work on JRuby though? Check out git@github.com:LTe/grape-rabl.git and run tests on JRuby. You will get the failure above. Maybe I am missing something?
This is killing us. @dblock , take a look at #471 I don't even know where to start.
Confirmed JRuby bug, https://github.com/jruby/jruby/issues/3009#issuecomment-108091994, made some progress to setting up JRuby tests for Rabl for when that's fixed (or trying to find a workaround), https://github.com/dblock/rabl/tree/jruby, but I ran into #632.
Was looking at https://github.com/LTe/grape-rabl/pull/22 which is failing on JRuby. Rabl doesn't support JRuby, oj and msgpack both fail to install, to start.