cerebris / jsonapi-resources

A resource-focused Rails library for developing JSON:API compliant servers.
http://jsonapi-resources.com
MIT License
2.32k stars 532 forks source link

undefined method `compact' #668

Closed marcinsklodowski closed 8 years ago

marcinsklodowski commented 8 years ago

Hi,

I keep getting undefined method `compact' error on master branch. I've noticed that it started to occur when PR #571 was merged.

Here's what I get from server:

{"errors"=>
  [{"title"=>"Internal Server Error",
    "detail"=>"Internal Server Error",
    "id"=>nil,
    "href"=>nil,
    "code"=>"500",
    "source"=>nil,
    "links"=>nil,
    "status"=>"500",
    "meta"=>
     {"exception"=>"undefined method `compact' for {:self=>\"http://test.host/api/v2/users/1\"}:Hash",
      "backtrace"=>
       ["/home/apps/bpp-events/current/jsonapi-resources/lib/jsonapi/resource_serializer.rb:169:in `links_hash'",
        "/home/apps/bpp-events/current/jsonapi-resources/lib/jsonapi/resource_serializer.rb:117:in `object_hash'",
        "/home/apps/bpp-events/current/jsonapi-resources/lib/jsonapi/resource_serializer.rb:102:in `process_primary'",
        "/home/apps/bpp-events/current/jsonapi-resources/lib/jsonapi/resource_serializer.rb:39:in `serialize_to_hash'",
        "/home/apps/bpp-events/current/jsonapi-resources/lib/jsonapi/response_document.rb:109:in `results_to_hash'",
        "/home/apps/bpp-events/current/jsonapi-resources/lib/jsonapi/response_document.rb:11:in `contents'",
        "/home/apps/bpp-events/current/jsonapi-resources/lib/jsonapi/acts_as_resource_controller.rb:155:in `render_results'", (...)

It works perfectly fine when I set HEAD before mentioned merge.

mmartinson commented 8 years ago

@marcinsklodowski is this issue still relevant?

lgebhardt commented 8 years ago

I'm not seeing this in the current master. If this is still an error please reopen.

jpalumickas commented 7 years ago

This is probably because compact on Hash was added on Rails >4.1 http://apidock.com/rails/Hash/compact