Hobo Fields hides some active model serializers.

24 views
Skip to first unread message

Donald Ziesig

unread,
Aug 26, 2016, 6:06:03 PM8/26/16
to Hobo Users
Hi All!

It's been a long time, but I'm back :-D.

I am currently working on a Single Page App using Rails 5 in api mode.
I don't need a lot of the Hobo goodies (e.g. dryml), but I really would
like to use Hobo Fields in my models.

Unfortunately, when I include gem 'hobo_fields' in Gemfile, my rspec
tests all fail with undefined constants. HashSerializer,
ObjectSerializer and BasicObjectSerializer are all missing (hidden?). I
was able to implement HashSerializer and ObjectSerializer myself, but
ObjectSerializer brought in BasicObjectSerializer and I couldn't find an
appropriate interface for it.

The error tracebacks all showed that hobo_support was at the top of the
stack as in:

Failure/Error: render json: { errors: user.errors }, status: 422

NameError:
uninitialized constant BasicObjectSerializer
#
/home/donz/.rvm/gems/ruby-2.3.0@authTemplate/gems/hobo_support-2.2.0/lib/hobo_support/string.rb:23:in
`class_eval'
#
/home/donz/.rvm/gems/ruby-2.3.0@authTemplate/gems/hobo_support-2.2.0/lib/hobo_support/string.rb:23:in
`class_eval'
#
/home/donz/.rvm/gems/ruby-2.3.0@authTemplate/gems/hobo_support-2.2.0/lib/hobo_support/string.rb:23:in
`safe_constantize'
#
/home/donz/.rvm/gems/ruby-2.3.0@authTemplate/gems/active_model_serializers-0.10.2/lib/active_model/serializer.rb:91:in
`map'

I removed hobo_fields from my gemfile and all of the tests passed.

Just in case it may be significant, the failures were all associated
with the errors field of the failing model objects. The models
themselves serialized fine.

One of the failing lines is:

render json: { errors: user.errors }, status: 422

Are there any suggested fixes for this?

Thanks,

Don Ziesig


Reply all
Reply to author
Forward
0 new messages