rails-api / active_model_serializers

ActiveModel::Serializer implementation and Rails hooks
MIT License
5.33k stars 1.39k forks source link

Serializer Does Not Render With JSONAPI Adapter #1978

Closed stephenhmarsh closed 7 years ago

stephenhmarsh commented 7 years ago

Expected behavior vs actual behavior

I have this in config/initializers/ams_jsonapi.rb:

ActiveModelSerializers.config.key_transform = :unaltered
ActiveModelSerializers.config.jsonapi_include_toplevel_object = true
ActiveModelSerializers.config.serializer_lookup_enabled = true
ActiveModelSerializers.config.jsonapi_resource_type = :singular
ActiveModelSerializers.config.adapter = :json_api

ActiveSupport.on_load(:action_controller) do
  require 'active_model_serializers/register_jsonapi_renderer'
end

And I have this:

class API::V1::ApiBaseController < ActionController::Base
  require 'active_model_serializers/register_jsonapi_renderer'
  include ActiveModelSerializers::Jsonapi::ControllerSupport

  def index
    render jsonapi: all_resources, adapter: 'json_api'
  end
end

which I'm hitting with this:

get "/v1/credfiles/#{@credfile.id}/notes", {}, { "CONTENT_TYPE" => 'application/vnd.api+json', 'HTTP_ACCEPT' => 'application/vnd.api+json'}

But the response I'm getting is NOT jsonapi. Instead I'm getting this:

[2] pry(#<RSpec::ExampleGroups::CredfileNotesController::IndexAction>)> response.body
"[{\"id\":5,\"created_at\":\"2016-11-16T17:40:59.191-05:00\",\"updated_at\":\"2016-11-16T17:40:59.191-05:00\",\"content\":\"Schlitz fap cred master tote bag. Whatever blue bottle cray marfa. Cliche yolo selfies cronut. Church-key literally poutine hoodie wes anderson fixie chia yr.\",\"client_id\":12,\"notationable_id\":1,\"notationable_type\":\"Requesty::Physical::Checklist\",\"user_id\":10},{\"id\":4,\"created_at\":\"2016-11-16T17:40:59.136-05:00\",\"updated_at\":\"2016-11-16T17:40:59.136-05:00\",\"content\":\"Helvetica celiac flannel beard dreamcatcher cornhole thundercats loko. Five dollar toast wolf you probably haven't heard of them tumblr cray tilde paleo.\",\"client_id\":10,\"notationable_id\":1,\"notationable_type\":\"Requesty::Physical::Checklist\",\"user_id\":8},{\"id\":3,\"created_at\":\"2016-11-16T17:40:59.080-05:00\",\"updated_at\":\"2016-11-16T17:40:59.080-05:00\",\"content\":\"Cleanse tilde bushwick. Polaroid typewriter austin bitters literally aesthetic waistcoat messenger bag.\",\"client_id\":8,\"notationable_id\":1,\"notationable_type\":\"Requesty::Physical::Checklist\",\"user_id\":6},{\"id\":2,\"created_at\":\"2016-11-16T17:40:59.003-05:00\",\"updated_at\":\"2016-11-16T17:40:59.003-05:00\",\"content\":\"Kale chips gastropub yolo flannel vinyl. Celiac mlkshk leggings raw denim diy. Narwhal sartorial cliche butcher occupy meh church-key. Trust fund shabby chic pinterest.\",\"client_id\":6,\"notationable_id\":1,\"notationable_type\":\"Requesty::Physical::Checklist\",\"user_id\":4},{\"id\":1,\"created_at\":\"2016-11-16T17:40:58.942-05:00\",\"updated_at\":\"2016-11-16T17:40:58.942-05:00\",\"content\":\"Twee pickled cardigan jean shorts pbr\\u0026b artisan. Vinegar sriracha mixtape retro.\",\"client_id\":4,\"notat

also this:

[1] pry(#<RSpec::ExampleGroups::CredfileNotesController::IndexAction>)> request.format
#<Mime::Type:0x007f9cae888e78 @synonyms=[], @symbol=:jsonapi, @string="application/vnd.api+json", @hash=-3487124632856839505>
ionable_id\":1,\"notationable_type\":\"Requesty::Physical::Checklist\",\"user_id\":2}]"
[3] pry(#<RSpec::ExampleGroups::CredfileNotesController::IndexAction>)> request.content_type
"application/vnd.api+json"
[4] pry(#<RSpec::ExampleGroups::CredfileNotesController::IndexAction>)> request.accept
"application/vnd.api+json"
[5] pry(#<RSpec::ExampleGroups::CredfileNotesController::IndexAction>)> ActiveModelSerializers::Adapter.adapter_map
{
    "json_api" => ActiveModelSerializers::Adapter::JsonApi < ActiveModelSerializers::Adapter::Base
}

I have tried all of these:

  def index
    render jsonapi: all_resources, adapter: :json_api
  end
  def index
    render jsonapi: all_resources, adapter: :jsonapi
  end
  def index
    render jsonapi: all_resources, adapter: 'jsonapi'
  end
  def index
    render jsonapi: all_resources, adapter: ActiveModelSerializers::Adapter::JsonApi
  end
  def index
    render json: all_resources, adapter: 'json_api'
  end

to no avail.

My logs say this:

17:40:59 test.1        | {"log_level":"INFO","time":"2016-11-16T17:40:59.639-05:00","message":"[active_model_serializers] Rendered ActiveModel::Serializer::CollectionSerializer with Physical::Note::ActiveRecord_Associations_CollectionProxy (1.41ms)"}

Steps to reproduce

(e.g., detailed walkthrough, runnable script, example application)

Please see above.

Environment

ActiveModelSerializers Version (commit ref if not on tag):

0.10.1

Output of ruby -e "puts RUBY_DESCRIPTION":

ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin14]

OS Type & Version:

OS X 10.10.5

Integrated application and version (e.g., Rails, Grape, etc):

Rails 4.2.7

Backtrace

(e.g., provide any applicable backtraces from your application)

Logs:

17:57:35 test.1        | {"log_level":"INFO","time":"2016-11-16T17:57:35.374-05:00","message":"Started GET \"/v1/credfiles/1/notes\" for 127.0.0.1 at 2016-11-16 17:57:35 -0500"}
17:57:35 test.1        | {"log_level":"DEBUG","time":"2016-11-16T17:57:35.429-05:00","message":"  \u001b[1m\u001b[35mPhysical::User Load (0.3ms)\u001b[0m  SELECT  \"users\".* FROM \"users\" WHERE \"users\".\"id\" = $1  ORDER BY \"users\".\"id\" ASC LIMIT 1  [[\"id\", 1]]"}
17:57:35 test.1        | {"log_level":"INFO","time":"2016-11-16T17:57:35.430-05:00","message":"Processing by API::V1::NotesController#index as JSONAPI"}
17:57:35 test.1        | {"log_level":"INFO","time":"2016-11-16T17:57:35.430-05:00","message":"  Parameters: {\"credfile_id\"=\u003e\"1\"}"}
17:57:35 test.1        | {"log_level":"DEBUG","time":"2016-11-16T17:57:35.432-05:00","message":"  \u001b[1m\u001b[36mPhysical::ClientRole Load (0.3ms)\u001b[0m  \u001b[1mSELECT \"client_roles\".* FROM \"client_roles\" INNER JOIN \"client_roles_users\" ON \"client_roles\".\"id\" = \"client_roles_users\".\"client_role_id\" WHERE \"client_roles_users\".\"user_id\" = $1\u001b[0m  [[\"user_id\", 1]]"}
17:57:35 test.1        | {"log_level":"DEBUG","time":"2016-11-16T17:57:35.433-05:00","message":"  \u001b[1m\u001b[35mPhysical::ClientRolesPermission Load (0.3ms)\u001b[0m  SELECT \"client_roles_permissions\".* FROM \"client_roles_permissions\" WHERE \"client_roles_permissions\".\"client_role_id\" = $1  [[\"client_role_id\", 1]]"}
17:57:35 test.1        | {"log_level":"DEBUG","time":"2016-11-16T17:57:35.436-05:00","message":"  \u001b[1m\u001b[36mRequesty::Physical::Checklist Load (0.2ms)\u001b[0m  \u001b[1mSELECT  \"checklists\".* FROM \"checklists\" WHERE \"checklists\".\"id\" = $1 LIMIT 1\u001b[0m  [[\"id\", 1]]"}
17:57:35 test.1        | {"log_level":"DEBUG","time":"2016-11-16T17:57:35.445-05:00","message":"  \u001b[1m\u001b[35mPhysical::Note Load (0.4ms)\u001b[0m  SELECT \"notes\".* FROM \"notes\" WHERE \"notes\".\"notationable_type\" = 'Requesty::Physical::Checklist' AND \"notes\".\"notationable_id\" IN (1)"}
17:57:35 test.1        | {"log_level":"INFO","time":"2016-11-16T17:57:35.454-05:00","message":"[active_model_serializers] Rendered ActiveModel::Serializer::CollectionSerializer with Physical::Note::ActiveRecord_Associations_CollectionProxy (1.39ms)"}
17:57:35 test.1        | {"log_level":"INFO","time":"2016-11-16T17:57:35.455-05:00","message":"Completed 200 OK in 24ms (Views: 8.8ms | ActiveRecord: 1.2ms)"}

Additonal helpful information

(e.g., Gemfile.lock, configurations, PR containing a failing test, git bisect results)

Gemfile.lock

GIT
  remote: https://github.com/josephbridgwaterrowe/promiscuous.git
  revision: 172af714f0380e373591913f54fbd058596380d2
  branch: active_record_migrations
  specs:
    promiscuous (1.0.0.beta6)
      activemodel (>= 3)
      activesupport (>= 3)
      algorithms (~> 0.6.1)
      amq-protocol (>= 1.8.0)
      bunny (>= 0.10.7)
      fnv (= 0.2.0)
      multi_json (~> 1.11.2)
      redis (~> 3.0)
      robust-redis-lock (~> 0.2.2)
      ruby-progressbar (= 1.7.5)

GIT
  remote: https://github.com/prawnpdf/prawn.git
  revision: 921f3986cddf92f94c516403bac2dfcfaeba0d33
  specs:
    prawn (2.1.1)
      pdf-core (~> 0.6.1)
      ttfunk (~> 1.4.0)

GIT
  remote: https://github.com/seuros/state_machine.git
  revision: 95ba53f03e5657a5873343c2b1dc6a148ea3542e
  specs:
    state_machine (1.2.0)

GEM
  remote: https://rubygems.org/
  specs:
    Ascii85 (1.0.2)
    CFPropertyList (2.3.3)
    actionmailer (4.2.7)
      actionpack (= 4.2.7)
      actionview (= 4.2.7)
      activejob (= 4.2.7)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 1.0, >= 1.0.5)
    actionpack (4.2.7)
      actionview (= 4.2.7)
      activesupport (= 4.2.7)
      rack (~> 1.6)
      rack-test (~> 0.6.2)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (4.2.7)
      activesupport (= 4.2.7)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    active_model_serializers (0.10.1)
      actionpack (>= 4.1, < 6)
      activemodel (>= 4.1, < 6)
      jsonapi (~> 0.1.1.beta2)
      railties (>= 4.1, < 6)
    activeadmin (1.0.0.pre2)
      arbre (~> 1.0, >= 1.0.2)
      bourbon
      coffee-rails
      formtastic (~> 3.1)
      formtastic_i18n
      inherited_resources (~> 1.6)
      jquery-rails
      jquery-ui-rails
      kaminari (~> 0.15)
      rails (>= 3.2, < 5.0)
      ransack (~> 1.3)
      sass-rails
    activejob (4.2.7)
      activesupport (= 4.2.7)
      globalid (>= 0.3.0)
    activemodel (4.2.7)
      activesupport (= 4.2.7)
      builder (~> 3.1)
    activerecord (4.2.7)
      activemodel (= 4.2.7)
      activesupport (= 4.2.7)
      arel (~> 6.0)
    activesupport (4.2.7)
      i18n (~> 0.7)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    addressable (2.4.0)
    afm (0.2.2)
    algorithms (0.6.1)
    amq-protocol (2.0.1)
    arbre (1.1.1)
      activesupport (>= 3.0.0)
    arel (6.0.3)
    attr_encrypted (3.0.3)
      encryptor (~> 3.0.0)
    awesome_print (1.7.0)
    aws-sdk (2.6.14)
      aws-sdk-resources (= 2.6.14)
    aws-sdk-core (2.6.14)
      jmespath (~> 1.0)
    aws-sdk-resources (2.6.14)
      aws-sdk-core (= 2.6.14)
    babel-source (5.8.35)
    babel-transpiler (0.7.0)
      babel-source (>= 4.0, < 6)
      execjs (~> 2.0)
    bcrypt (3.1.11)
    better_errors (2.1.1)
      coderay (>= 1.0.0)
      erubis (>= 2.6.6)
      rack (>= 0.9.0)
    binding_of_caller (0.7.2)
      debug_inspector (>= 0.0.1)
    bootstrap-sass (2.3.2.1)
      sass (~> 3.2)
    bootswatch-rails (0.5.0)
      railties (>= 3.1)
    bourbon (4.2.7)
      sass (~> 3.4)
      thor (~> 0.19)
    brakeman (3.4.0)
    bugsnag (5.0.1)
    builder (3.2.2)
    bunny (2.6.1)
      amq-protocol (>= 2.0.1)
    capybara (2.10.1)
      addressable
      mime-types (>= 1.16)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      xpath (~> 2.0)
    carrierwave (0.11.2)
      activemodel (>= 3.2.0)
      activesupport (>= 3.2.0)
      json (>= 1.7)
      mime-types (>= 1.16)
      mimemagic (>= 0.3.0)
    carrierwave-base64 (2.3.2)
      carrierwave (>= 0.8.0)
    carrierwave_backgrounder (0.4.2)
      carrierwave (~> 0.5)
    chartkick (2.1.1)
    childprocess (0.5.9)
      ffi (~> 1.0, >= 1.0.11)
    choice (0.2.0)
    chronic (0.10.2)
    coderay (1.1.1)
    coffee-rails (4.2.1)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.2.x)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.10.0)
    concurrent-ruby (1.0.2)
    config (1.0.0)
      activesupport (>= 3.0)
      deep_merge (~> 1.0.0)
    connection_pool (2.2.0)
    crack (0.4.3)
      safe_yaml (~> 1.0.0)
    daemon_controller (1.2.0)
    daemons (1.2.4)
    database_cleaner (1.5.3)
    debug_inspector (0.0.2)
    deep_merge (1.0.1)
    devise (3.5.10)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 3.2.6, < 5)
      responders
      thread_safe (~> 0.1)
      warden (~> 1.2.3)
    devise_invitable (1.6.1)
      actionmailer (>= 3.2.6)
      devise (>= 3.2.0)
    devise_security_extension (0.10.0)
      devise (>= 3.0.0, < 4.0)
      railties (>= 3.2.6, < 5.0)
    diff-lcs (1.2.5)
    docile (1.1.5)
    domain_name (0.5.20161021)
      unf (>= 0.0.5, < 1.0.0)
    dotenv (2.1.1)
    dotenv-rails (2.1.1)
      dotenv (= 2.1.1)
      railties (>= 4.0, < 5.1)
    encryptor (3.0.0)
    erubis (2.7.0)
    eventmachine (1.0.9.1)
    excon (0.54.0)
    execjs (2.7.0)
    factory_girl (4.7.0)
      activesupport (>= 3.0.0)
    factory_girl_rails (4.7.0)
      factory_girl (~> 4.7.0)
      railties (>= 3.0.0)
    faker (1.6.6)
      i18n (~> 0.5)
    faraday (0.9.2)
      multipart-post (>= 1.2, < 3)
    faraday_middleware (0.10.0)
      faraday (>= 0.7.4, < 0.10)
    ffi (1.9.14)
    fission (0.5.0)
      CFPropertyList (~> 2.2)
    fnv (0.2.0)
    fog (1.38.0)
      fog-aliyun (>= 0.1.0)
      fog-atmos
      fog-aws (>= 0.6.0)
      fog-brightbox (~> 0.4)
      fog-cloudatcost (~> 0.1.0)
      fog-core (~> 1.32)
      fog-dynect (~> 0.0.2)
      fog-ecloud (~> 0.1)
      fog-google (<= 0.1.0)
      fog-json
      fog-local
      fog-openstack
      fog-powerdns (>= 0.1.1)
      fog-profitbricks
      fog-rackspace
      fog-radosgw (>= 0.0.2)
      fog-riakcs
      fog-sakuracloud (>= 0.0.4)
      fog-serverlove
      fog-softlayer
      fog-storm_on_demand
      fog-terremark
      fog-vmfusion
      fog-voxel
      fog-vsphere (>= 0.4.0)
      fog-xenserver
      fog-xml (~> 0.1.1)
      ipaddress (~> 0.5)
    fog-aliyun (0.1.0)
      fog-core (~> 1.27)
      fog-json (~> 1.0)
      ipaddress (~> 0.8)
      xml-simple (~> 1.1)
    fog-atmos (0.1.0)
      fog-core
      fog-xml
    fog-aws (0.12.0)
      fog-core (~> 1.38)
      fog-json (~> 1.0)
      fog-xml (~> 0.1)
      ipaddress (~> 0.8)
    fog-brightbox (0.11.0)
      fog-core (~> 1.22)
      fog-json
      inflecto (~> 0.0.2)
    fog-cloudatcost (0.1.2)
      fog-core (~> 1.36)
      fog-json (~> 1.0)
      fog-xml (~> 0.1)
      ipaddress (~> 0.8)
    fog-core (1.43.0)
      builder
      excon (~> 0.49)
      formatador (~> 0.2)
    fog-dynect (0.0.3)
      fog-core
      fog-json
      fog-xml
    fog-ecloud (0.3.0)
      fog-core
      fog-xml
    fog-google (0.1.0)
      fog-core
      fog-json
      fog-xml
    fog-json (1.0.2)
      fog-core (~> 1.0)
      multi_json (~> 1.10)
    fog-local (0.3.1)
      fog-core (~> 1.27)
    fog-openstack (0.1.15)
      fog-core (>= 1.40)
      fog-json (>= 1.0)
      ipaddress (>= 0.8)
    fog-powerdns (0.1.1)
      fog-core (~> 1.27)
      fog-json (~> 1.0)
      fog-xml (~> 0.1)
    fog-profitbricks (2.0.1)
      fog-core (~> 1.42)
      fog-json (~> 1.0)
    fog-rackspace (0.1.1)
      fog-core (>= 1.35)
      fog-json (>= 1.0)
      fog-xml (>= 0.1)
      ipaddress (>= 0.8)
    fog-radosgw (0.0.5)
      fog-core (>= 1.21.0)
      fog-json
      fog-xml (>= 0.0.1)
    fog-riakcs (0.1.0)
      fog-core
      fog-json
      fog-xml
    fog-sakuracloud (1.7.5)
      fog-core
      fog-json
    fog-serverlove (0.1.2)
      fog-core
      fog-json
    fog-softlayer (1.1.4)
      fog-core
      fog-json
    fog-storm_on_demand (0.1.1)
      fog-core
      fog-json
    fog-terremark (0.1.0)
      fog-core
      fog-xml
    fog-vmfusion (0.1.0)
      fission
      fog-core
    fog-voxel (0.1.0)
      fog-core
      fog-xml
    fog-vsphere (1.5.0)
      fog-core
      rbvmomi (~> 1.9)
    fog-xenserver (0.2.3)
      fog-core
      fog-xml
    fog-xml (0.1.2)
      fog-core
      nokogiri (~> 1.5, >= 1.5.11)
    font-awesome-rails (3.2.1.0)
      railties (>= 3.2, < 5.0)
    formatador (0.2.5)
    formtastic (3.1.4)
      actionpack (>= 3.2.13)
    formtastic_i18n (0.6.0)
    gli (2.14.0)
    globalid (0.3.7)
      activesupport (>= 4.1.0)
    groupdate (3.1.1)
      activesupport (>= 3)
    growl (1.0.3)
    guard (2.14.0)
      formatador (>= 0.2.4)
      listen (>= 2.7, < 4.0)
      lumberjack (~> 1.0)
      nenv (~> 0.1)
      notiffany (~> 0.0)
      pry (>= 0.9.12)
      shellany (~> 0.0)
      thor (>= 0.18.1)
    guard-brakeman (0.8.3)
      brakeman (>= 2.1.1)
      guard (>= 2.0.0)
    guard-compat (1.2.1)
    guard-rspec (4.7.3)
      guard (~> 2.1)
      guard-compat (~> 1.1)
      rspec (>= 2.99.0, < 4.0)
    guard-spork (2.1.0)
      childprocess (>= 0.2.3)
      guard (~> 2.0)
      guard-compat (~> 1.0)
      spork (>= 0.8.4)
    has_scope (0.6.0)
      actionpack (>= 3.2, < 5)
      activesupport (>= 3.2, < 5)
    hashdiff (0.3.0)
    hashery (2.1.2)
    hashie (3.4.6)
    http-cookie (1.0.3)
      domain_name (~> 0.5)
    httparty (0.14.0)
      multi_xml (>= 0.5.2)
    i18n (0.7.0)
    inflecto (0.0.2)
    inherited_resources (1.6.0)
      actionpack (>= 3.2, < 5)
      has_scope (~> 0.6.0.rc)
      railties (>= 3.2, < 5)
      responders
    intercom-rails (0.3.4)
      activesupport (> 3.0)
    ipaddress (0.8.3)
    jasmine-core (2.5.2)
    jasmine-jquery-rails (2.0.3)
    jasmine-rails (0.14.1)
      jasmine-core (>= 1.3, < 3.0)
      phantomjs (>= 1.9)
      railties (>= 3.2.0)
      sprockets-rails
    jmespath (1.3.1)
    jquery-rails (4.2.1)
      rails-dom-testing (>= 1, < 3)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    jquery-ui-rails (5.0.5)
      railties (>= 3.2.16)
    json (1.8.3)
    jsonapi (0.1.1.beta6)
      jsonapi-parser (= 0.1.1.beta3)
      jsonapi-renderer (= 0.1.1.beta1)
    jsonapi-parser (0.1.1.beta3)
    jsonapi-renderer (0.1.1.beta1)
    kaminari (0.17.0)
      actionpack (>= 3.0.0)
      activesupport (>= 3.0.0)
    kgio (2.10.0)
    launchy (2.4.3)
      addressable (~> 2.3)
    letter_opener (1.4.1)
      launchy (~> 2.2)
    listen (3.1.5)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
      ruby_dep (~> 1.2)
    lograge (0.4.1)
      actionpack (>= 4, < 5.1)
      activesupport (>= 4, < 5.1)
      railties (>= 4, < 5.1)
    logstash-event (1.2.02)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    lumberjack (1.0.10)
    mail (2.6.4)
      mime-types (>= 1.16, < 4)
    mailcatcher (0.6.5)
      eventmachine (= 1.0.9.1)
      mail (~> 2.3)
      rack (~> 1.5)
      sinatra (~> 1.2)
      skinny (~> 0.2.3)
      sqlite3 (~> 1.3)
      thin (~> 1.5.0)
    method_source (0.8.2)
    mime-types (3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0521)
    mimemagic (0.3.2)
    mini_portile2 (2.1.0)
    minitest (5.9.1)
    modernizr-rails (2.7.1)
    multi_json (1.11.3)
    multi_xml (0.5.5)
    multipart-post (2.0.0)
    nenv (0.3.0)
    netrc (0.11.0)
    nokogiri (1.6.8.1)
      mini_portile2 (~> 2.1.0)
    nokogiri-happymapper (0.5.9)
      nokogiri (~> 1.5)
    notiffany (0.1.1)
      nenv (~> 0.1)
      shellany (~> 0.0)
    orm_adapter (0.5.0)
    passenger (4.0.60)
      daemon_controller (>= 1.2.0)
      rack
      rake (>= 0.8.1)
    pdf-core (0.6.1)
    pdf-reader (1.4.0)
      Ascii85 (~> 1.0.0)
      afm (~> 0.2.1)
      hashery (~> 2.0)
      ruby-rc4
      ttfunk
    pg (0.19.0)
    phantomjs (2.1.1.0)
    pivotal-tracker (0.5.13)
      builder
      crack
      nokogiri (>= 1.5.5)
      nokogiri-happymapper (>= 0.5.4)
      rest-client (>= 1.8.0)
    polyamorous (1.3.1)
      activerecord (>= 3.0)
    prawn-table (0.2.2)
      prawn (>= 1.3.0, < 3.0.0)
    pry (0.10.4)
      coderay (~> 1.1.0)
      method_source (~> 0.8.1)
      slop (~> 3.4)
    rack (1.6.5)
    rack-protection (1.5.3)
      rack
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (4.2.7)
      actionmailer (= 4.2.7)
      actionpack (= 4.2.7)
      actionview (= 4.2.7)
      activejob (= 4.2.7)
      activemodel (= 4.2.7)
      activerecord (= 4.2.7)
      activesupport (= 4.2.7)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.2.7)
      sprockets-rails
    rails-deprecated_sanitizer (1.0.3)
      activesupport (>= 4.2.0.alpha)
    rails-dom-testing (1.0.7)
      activesupport (>= 4.2.0.beta, < 5.0)
      nokogiri (~> 1.6.0)
      rails-deprecated_sanitizer (>= 1.0.1)
    rails-erd (1.5.0)
      activerecord (>= 3.2)
      activesupport (>= 3.2)
      choice (~> 0.2.0)
      ruby-graphviz (~> 1.2)
    rails-footnotes (4.1.8)
      rails (>= 3.2)
    rails-html-sanitizer (1.0.3)
      loofah (~> 2.0)
    rails_email_validator (0.1.4)
      activemodel (>= 3.0.0)
    railties (4.2.7)
      actionpack (= 4.2.7)
      activesupport (= 4.2.7)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    raindrops (0.17.0)
    rake (11.3.0)
    ransack (1.8.2)
      actionpack (>= 3.0)
      activerecord (>= 3.0)
      activesupport (>= 3.0)
      i18n
      polyamorous (~> 1.3)
    rb-fsevent (0.9.8)
    rb-inotify (0.9.7)
      ffi (>= 0.5.0)
    rbvmomi (1.9.4)
      builder (~> 3.2)
      json (>= 1.8)
      nokogiri (~> 1.5)
      trollop (~> 2.1)
    react-rails (1.9.0)
      babel-transpiler (>= 0.7.0)
      coffee-script-source (~> 1.8)
      connection_pool
      execjs
      railties (>= 3.2)
      tilt
    redis (3.3.1)
    redis-namespace (1.5.2)
      redis (~> 3.0, >= 3.0.4)
    responders (2.3.0)
      railties (>= 4.2.0, < 5.1)
    rest-client (2.0.0)
      http-cookie (>= 1.0.2, < 2.0)
      mime-types (>= 1.16, < 4.0)
      netrc (~> 0.8)
    robust-redis-lock (0.2.2)
      redis (>= 3.0.0)
    rspec (3.5.0)
      rspec-core (~> 3.5.0)
      rspec-expectations (~> 3.5.0)
      rspec-mocks (~> 3.5.0)
    rspec-core (3.5.4)
      rspec-support (~> 3.5.0)
    rspec-expectations (3.5.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.5.0)
    rspec-mocks (3.5.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.5.0)
    rspec-rails (3.5.2)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec-core (~> 3.5.0)
      rspec-expectations (~> 3.5.0)
      rspec-mocks (~> 3.5.0)
      rspec-support (~> 3.5.0)
    rspec-support (3.5.0)
    ruby-graphviz (1.2.2)
    ruby-progressbar (1.7.5)
    ruby-rc4 (0.1.5)
    ruby_dep (1.5.0)
    rubyzip (1.2.0)
    safe_yaml (1.0.4)
    sass (3.4.22)
    sass-rails (5.0.6)
      railties (>= 4.0.0, < 6)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (>= 1.1, < 3)
    selenium-webdriver (3.0.0)
      childprocess (~> 0.5)
      rubyzip (~> 1.0)
      websocket (~> 1.0)
    shellany (0.0.1)
    shoulda (3.5.0)
      shoulda-context (~> 1.0, >= 1.0.1)
      shoulda-matchers (>= 1.4.1, < 3.0)
    shoulda-callback-matchers (1.1.4)
      activesupport (>= 3)
    shoulda-context (1.2.1)
    shoulda-matchers (2.8.0)
      activesupport (>= 3.0.0)
    sidekiq (4.2.3)
      concurrent-ruby (~> 1.0)
      connection_pool (~> 2.2, >= 2.2.0)
      rack-protection (>= 1.5.0)
      redis (~> 3.2, >= 3.2.1)
    simple_form (3.3.1)
      actionpack (> 4, < 5.1)
      activemodel (> 4, < 5.1)
    simplecov (0.12.0)
      docile (~> 1.1.0)
      json (>= 1.8, < 3)
      simplecov-html (~> 0.10.0)
    simplecov-html (0.10.0)
    sinatra (1.4.7)
      rack (~> 1.5)
      rack-protection (~> 1.4)
      tilt (>= 1.3, < 3)
    skinny (0.2.4)
      eventmachine (~> 1.0.0)
      thin (>= 1.5, < 1.7)
    slack-ruby-client (0.7.7)
      activesupport
      faraday
      faraday_middleware
      gli
      hashie
      json
      websocket-driver
    slop (3.6.0)
    smarty_streets (0.0.6)
      httparty (~> 0.11)
    spork (1.0.0rc4)
    spork-rails (4.0.0)
      rails (>= 3.0.0, < 5)
      spork (>= 1.0rc0)
    sprockets (3.7.0)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.0)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    sqlite3 (1.3.12)
    state_machine-audit_trail (0.1.9)
      state_machine
    thin (1.5.1)
      daemons (>= 1.0.9)
      eventmachine (>= 0.12.6)
      rack (>= 1.0.0)
    thor (0.19.1)
    thread_safe (0.3.5)
    tilt (2.0.5)
    timecop (0.8.1)
    trollop (2.1.2)
    ttfunk (1.4.0)
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    uglifier (3.0.3)
      execjs (>= 0.3.0, < 3)
    unf (0.1.4)
      unf_ext
    unf_ext (0.0.7.2)
    unicorn (5.2.0)
      kgio (~> 2.6)
      raindrops (~> 0.7)
    warden (1.2.6)
      rack (>= 1.0)
    webmock (2.1.0)
      addressable (>= 2.3.6)
      crack (>= 0.3.2)
      hashdiff
    websocket (1.2.3)
    websocket-driver (0.6.4)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.2)
    xml-simple (1.1.5)
    xpath (2.0.0)
      nokogiri (~> 1.3)

PLATFORMS
  ruby

DEPENDENCIES
  actionpack
  active_model_serializers (= 0.10.1)
  activeadmin (= 1.0.0.pre2)
  attr_encrypted
  awesome_print
  aws-sdk
  better_errors
  binding_of_caller
  bootstrap-sass (= 2.3.2.1)
  bootswatch-rails (= 0.5.0)
  brakeman
  bugsnag
  capybara
  carrierwave
  carrierwave-base64
  carrierwave_backgrounder
  chartkick
  childprocess
  chronic
  config
  database_cleaner
  devise (~> 3.5.0)
  devise_invitable
  devise_security_extension
  dotenv-rails
  factory_girl_rails
  faker
  fog
  font-awesome-rails (= 3.2.1.0)
  groupdate
  growl
  guard-brakeman
  guard-rspec
  guard-spork
  intercom-rails
  jasmine-jquery-rails
  jasmine-rails
  jquery-rails
  jquery-ui-rails
  kaminari
  letter_opener
  lograge
  logstash-event
  mailcatcher
  modernizr-rails
  passenger (~> 4.0.59)
  pdf-reader
  pg
  pivotal-tracker
  prawn!
  prawn-table
  promiscuous!
  pry
  rails (= 4.2.7)
  rails-erd
  rails-footnotes
  rails_email_validator
  ransack
  react-rails
  redis-namespace
  rest-client
  rspec-rails
  sass
  sass-rails
  selenium-webdriver
  shoulda
  shoulda-callback-matchers
  sidekiq
  simple_form
  simplecov
  sinatra
  slack-ruby-client
  smarty_streets
  spork-rails
  sprockets-rails
  state_machine!
  state_machine-audit_trail
  thin
  timecop
  uglifier
  unf
  unicorn
  webmock

BUNDLED WITH
   1.12.5
beauby commented 7 years ago

"literally poutine hoodie wes anderson fixie", now that's a combo :+1:.

  1. You shouldn't need adapter: 'json_api' if you render via jsonapi:.
  2. This looks like no serializer was found for your objects. Could you add the output of all_resources.first.class.name and show me the definition of the corresponding serializer?
NullVoxPopuli commented 7 years ago

looks like another use case for throwing serializer not found error with some info attached. :-\

bf4 commented 7 years ago

@nullvoxpopuli only if you require one. Ams is really a presenter for as_json/to_json, Ruby already does. How should ams know you want all non-strings to require serializers?

stephenhmarsh commented 7 years ago

Thanks @beauby !!!!!! I had the naming convention right, but I'd moved it out of a module and forgotten to move the file out of the submodule folder. it was originally in: app/serializers/requesty/physical/ it should've been in: app/serializers/physical/

Been chasing my tail for so long I would've never caught that.

To @NullVoxPopuli's point I will say getting everything configured to work AUTOMAGICALLY has been the biggest challenge for me with AMS. @bf4 brings up a good point that there is a dilemma of knowing if someone wants a serializer or not... but I would be satisfied with a well-documented helper method or rake task that could find ActiveModel classes that don't have matching serializers and then tell me what to name them and where to put them.

Thanks everyone.

ClayShentrup commented 7 years ago

/register_jsonapi_renderer

OMG this saved me! After HOURS of searching. Thank you.