Closed stephenhmarsh closed 7 years ago
"literally poutine hoodie wes anderson fixie", now that's a combo :+1:.
adapter: 'json_api'
if you render via jsonapi:
.all_resources.first.class.name
and show me the definition of the corresponding serializer?looks like another use case for throwing serializer not found error with some info attached. :-\
@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?
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.
/register_jsonapi_renderer
OMG this saved me! After HOURS of searching. Thank you.
Expected behavior vs actual behavior
I have this in
config/initializers/ams_jsonapi.rb
:And I have this:
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:
also this:
I have tried all of these:
to no avail.
My logs say this:
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:
Additonal helpful information
(e.g., Gemfile.lock, configurations, PR containing a failing test, git bisect results)
Gemfile.lock