Namespaced models shows a weird type in JSON API. #2034
Closed as not planned
Description
I'm having an issue, where I use namespacing with modules for some of my models, for simple readability, in my rails project. However, when using the JSON-API, I get type
s like customer-customers
for Customer::Customer
.
Quite simply, having a model, like:
class Customer::Customer < ApplicationRecord
...
end
and using render json: Customer::Customer.first, serializer: CustomerSerializer
, will show JSON with type: "customer-customers"
in it..
I believe that this should be namespaced like customer/customers
or atleast, with an option to show only customers
, as if it weren't namespaced?
ActiveModelSerializers Version active_model_serializers (0.10.2). (Directly from rubygems)
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16]
MacOS: 10.12.2
Rails 5.0.1, with the following Gemfile.lock
GIT
remote: git://github.com/ankane/ahoy.git
revision: 67b2760bf2bd346c346e3547055ca762dad8bf29
tag: v1.5.2
specs:
ahoy_matey (1.5.2)
addressable
browser (~> 2.0)
geocoder
rack-attack (< 6)
railties
referer-parser (>= 0.3.0)
request_store
safely_block (>= 0.1.1)
user_agent_parser
uuidtools
GIT
remote: git://github.com/ankane/groupdate.git
revision: a6d29ebbc425d8940f92d063f42f3d9ae5055cca
specs:
groupdate (3.1.1)
activesupport (>= 3)
GIT
remote: git://github.com/prograsdk/dynaccount.git
revision: 9de29978a9c330d28b7011aea3a605bc0736a00d
specs:
dynaccount (0.10.0)
faraday (~> 0.10)
json (>= 1.8, < 3)
net-http-persistent (< 3)
GIT
remote: git://github.com/rails/actionpack-action_caching.git
revision: 9044141824650138bf27741e8f0ed95ccd9ef26d
specs:
actionpack-action_caching (1.1.1)
actionpack (>= 4.0.0, < 6)
GIT
remote: git://github.com/rails/actionpack-page_caching.git
revision: 6138221b8e5f522f9b901f2c19f3b1719742d2bf
specs:
actionpack-page_caching (1.0.2)
actionpack (>= 4.0.0, < 6)
GEM
remote: https://rubygems.org/
specs:
actioncable (5.0.1)
actionpack (= 5.0.1)
nio4r (~> 1.2)
websocket-driver (~> 0.6.1)
actionmailer (5.0.1)
actionpack (= 5.0.1)
actionview (= 5.0.1)
activejob (= 5.0.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.0.1)
actionview (= 5.0.1)
activesupport (= 5.0.1)
rack (~> 2.0)
rack-test (~> 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.0.1)
activesupport (= 5.0.1)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
active-model-adapter-source (2.1.1)
ember-data-source (>= 1.13, < 3.0)
active_model_serializers (0.10.2)
actionpack (>= 4.1, < 6)
activemodel (>= 4.1, < 6)
jsonapi (~> 0.1.1.beta2)
railties (>= 4.1, < 6)
activejob (5.0.1)
activesupport (= 5.0.1)
globalid (>= 0.3.6)
activemodel (5.0.1)
activesupport (= 5.0.1)
activerecord (5.0.1)
activemodel (= 5.0.1)
activesupport (= 5.0.1)
arel (~> 7.0)
activesupport (5.0.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.5.0)
public_suffix (~> 2.0, >= 2.0.2)
airbrake (5.6.1)
airbrake-ruby (~> 1.6)
airbrake-ruby (1.6.0)
animate-rails (1.0.10)
rails
arel (7.1.4)
ast (2.3.0)
autoprefixer-rails (6.6.1)
execjs
aws-sdk (2.6.44)
aws-sdk-resources (= 2.6.44)
aws-sdk-core (2.6.44)
aws-sigv4 (~> 1.0)
jmespath (~> 1.0)
aws-sdk-resources (2.6.44)
aws-sdk-core (= 2.6.44)
aws-sigv4 (1.0.0)
aws_cf_signer (0.1.3)
babel-source (5.8.35)
babel-transpiler (0.7.0)
babel-source (>= 4.0, < 6)
execjs (~> 2.0)
benchmark-ips (2.7.2)
bootstrap-sass (3.3.7)
autoprefixer-rails (>= 5.2.1)
sass (>= 3.3.4)
bootstrap3-datetimepicker-rails (4.17.43)
momentjs-rails (>= 2.8.1)
bourbon (4.2.7)
sass (~> 3.4)
thor (~> 0.19)
browser (2.3.0)
builder (3.2.2)
byebug (9.0.6)
cancan (1.6.10)
chartkick (2.2.2)
chunky_png (1.3.8)
climate_control (0.1.0)
cloudflare (2.1.0)
json (~> 1)
cloudinary (1.3.0)
aws_cf_signer
rest-client
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
codecov (0.1.9)
json
simplecov
url
coderay (1.1.1)
coffee-rails (4.1.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.1.x)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.0.4)
connection_pool (2.2.1)
crack (0.4.3)
safe_yaml (~> 1.0.0)
daemons (1.2.4)
dalli (2.7.6)
database_cleaner (1.5.3)
derailed (0.1.0)
derailed_benchmarks
derailed_benchmarks (1.3.1)
benchmark-ips (~> 2)
get_process_mem (~> 0)
heapy (~> 0)
memory_profiler (~> 0)
rack (>= 1)
rake (> 10, < 12)
thor (~> 0.19)
diff-lcs (1.2.5)
docile (1.1.5)
domain_name (0.5.20161129)
unf (>= 0.0.5, < 1.0.0)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
ember-data-source (2.10.0)
ember-source (>= 2, < 3.0)
ember-source (2.10.2)
errbase (0.0.3)
erubis (2.7.0)
eventmachine (1.0.9.1)
execjs (2.7.0)
factory_girl (4.8.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.8.0)
factory_girl (~> 4.8.0)
railties (>= 3.0.0)
faraday (0.10.1)
multipart-post (>= 1.2, < 3)
ffi (1.9.14)
flag-icons-rails (1.1.2)
sass (~> 3.2)
font-awesome-rails (4.7.0.1)
railties (>= 3.2, < 5.1)
formatador (0.2.5)
geocoder (1.4.1)
get_process_mem (0.2.1)
gli (2.14.0)
globalid (0.3.7)
activesupport (>= 4.1.0)
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-compat (1.2.1)
guard-livereload (2.5.2)
em-websocket (~> 0.5)
guard (~> 2.8)
guard-compat (~> 1.0)
multi_json (~> 1.8)
guard-rspec (4.7.3)
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
haml (4.0.7)
tilt
hashdiff (0.3.2)
heapy (0.1.2)
highcharts-rails (4.2.5)
railties (>= 3.1)
hiredis (0.6.1)
http-cookie (1.0.3)
domain_name (~> 0.5)
http_parser.rb (0.6.0)
i18n (0.7.0)
jmespath (1.3.1)
jquery-rails (4.2.2)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (6.0.1)
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)
knockoutjs-rails (3.4.0.1)
railties (>= 3.1, < 6)
libv8 (3.16.14.17)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
localeapp (2.0.0)
gli
i18n (~> 0.4)
json (~> 1.8)
mime-types (~> 2.6)
rest-client (~> 1.8)
ya2yaml
loofah (2.0.3)
nokogiri (>= 1.5.9)
lumberjack (1.0.10)
mail (2.6.4)
mime-types (>= 1.16, < 4)
mailcatcher (0.2.4)
eventmachine
haml
i18n
json
mail
sinatra
skinny (>= 0.1.2)
sqlite3-ruby
thin
memory_profiler (0.9.7)
method_source (0.8.2)
mime-types (2.99.3)
mimemagic (0.3.2)
mini_portile2 (2.1.0)
minitest (5.10.1)
momentjs-rails (2.15.1)
railties (>= 3.1)
multi_json (1.12.1)
multipart-post (2.0.0)
nenv (0.3.0)
nest (3.0.0)
redic
net-http-persistent (2.9.4)
netrc (0.11.0)
newrelic_rpm (3.17.2.327)
nio4r (1.2.1)
nokogiri (1.7.0.1)
mini_portile2 (~> 2.1.0)
notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
oauth (0.5.1)
ohm (3.1.1)
nest (~> 3)
redic (~> 1.5.0)
stal
paperclip (5.1.0)
activemodel (>= 4.2.0)
activesupport (>= 4.2.0)
cocaine (~> 0.5.5)
mime-types
mimemagic (~> 0.3.0)
paranoia (2.2.0)
activerecord (>= 4.0, < 5.1)
parser (2.3.3.1)
ast (~> 2.2)
pg (0.19.0)
phony (2.15.38)
phony_rails (0.14.4)
activesupport (>= 3.0)
phony (~> 2.15)
powerpack (0.1.1)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
public_suffix (2.0.5)
puma (3.6.2)
puma_worker_killer (0.0.7)
get_process_mem (~> 0.2)
puma (>= 2.7, < 4)
rack (2.0.1)
rack-attack (5.0.1)
rack
rack-cache (1.6.1)
rack (>= 0.4)
rack-cors (0.4.0)
rack-protection (1.5.3)
rack
rack-test (0.6.3)
rack (>= 1.0)
rails (5.0.1)
actioncable (= 5.0.1)
actionmailer (= 5.0.1)
actionpack (= 5.0.1)
actionview (= 5.0.1)
activejob (= 5.0.1)
activemodel (= 5.0.1)
activerecord (= 5.0.1)
activesupport (= 5.0.1)
bundler (>= 1.3.0, < 2.0)
railties (= 5.0.1)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.2)
activesupport (>= 4.2.0, < 6.0)
nokogiri (~> 1.6)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
rails_12factor (0.0.3)
rails_serve_static_assets
rails_stdout_logging
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
railties (5.0.1)
actionpack (= 5.0.1)
activesupport (= 5.0.1)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.2.1)
rake (11.3.0)
rb-fsevent (0.9.8)
rb-inotify (0.9.7)
ffi (>= 0.5.0)
redic (1.5.0)
hiredis
redis (3.3.2)
redis-namespace (1.5.2)
redis (~> 3.0, >= 3.0.4)
ref (2.0.0)
referer-parser (0.3.0)
request_store (1.3.2)
rest-client (1.8.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
rqrcode (0.10.1)
chunky_png (~> 1.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)
rubocop (0.46.0)
parser (>= 2.3.1.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.8.1)
ruby_dep (1.5.0)
rufus-scheduler (3.3.2)
tzinfo
safe_yaml (1.0.4)
safely_block (0.1.1)
errbase
sass (3.4.23)
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)
shellany (0.0.1)
sidekiq (4.2.8)
concurrent-ruby (~> 1.0)
connection_pool (~> 2.2, >= 2.2.0)
rack-protection (>= 1.5.0)
redis (~> 3.2, >= 3.2.1)
sidekiq-cron (0.4.5)
redis-namespace (>= 1.5.2)
rufus-scheduler (>= 2.0.24)
sidekiq (>= 4.2.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.0)
rack (>= 1.0)
skinny (0.2.4)
eventmachine (~> 1.0.0)
thin (>= 1.5, < 1.7)
slack-notifier (1.5.1)
slop (3.6.0)
spring (2.0.0)
activesupport (>= 4.2)
sprockets (3.7.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-es6 (0.9.2)
babel-source (>= 5.8.11)
babel-transpiler
sprockets (>= 3.0.0)
sprockets-rails (3.2.0)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.13)
sqlite3-ruby (1.3.3)
sqlite3 (>= 1.3.3)
stal (0.3.0)
redic (~> 1.5)
stripe (1.57.1)
rest-client (>= 1.4, < 4.0)
therubyracer (0.12.3)
libv8 (~> 3.16.14.15)
ref
thin (1.6.2)
daemons (>= 1.0.9)
eventmachine (>= 1.0.0)
rack (>= 1.0.0)
thor (0.19.4)
thread_safe (0.3.5)
tilt (2.0.5)
turbolinks (5.0.1)
turbolinks-source (~> 5)
turbolinks-source (5.0.0)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (3.0.4)
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.2)
unicode-display_width (1.1.2)
url (0.3.2)
user_agent_parser (2.3.0)
uuidtools (2.1.5)
webmock (2.3.2)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
websocket-driver (0.6.4)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
will_paginate (3.1.5)
will_paginate-bootstrap (1.0.1)
will_paginate (>= 3.0.3)
ya2yaml (0.31)
PLATFORMS
ruby
DEPENDENCIES
actionpack-action_caching!
actionpack-page_caching!
active-model-adapter-source (= 2.1.1)
active_model_serializers (= 0.10.2)
ahoy_matey!
airbrake (~> 5.6)
animate-rails
aws-sdk (~> 2.3)
bootstrap-sass (~> 3.3)
bootstrap3-datetimepicker-rails (~> 4.17.37)
bourbon (~> 4.2)
byebug
cancan
chartkick (~> 2.2, >= 2.2.2)
cloudflare
cloudinary
codecov
coffee-rails (~> 4.1.0)
connection_pool
dalli (~> 2.7)
database_cleaner (~> 1.4)
derailed
dynaccount!
factory_girl_rails (~> 4.5)
faraday (~> 0.9)
flag-icons-rails
font-awesome-rails
groupdate!
guard-livereload
guard-rspec
highcharts-rails
hiredis (~> 0.4)
jquery-rails
jquery-ui-rails
knockoutjs-rails (~> 3.3)
libv8
localeapp
mailcatcher
momentjs-rails (>= 2.11.1)
newrelic_rpm
oauth
ohm
paperclip (~> 5.0)
paranoia (~> 2.2)
pg
phony_rails
pry
puma (~> 3.6)
puma_worker_killer
rack-cache (~> 1.3)
rack-cors
rails (= 5.0.1)
rails_12factor
redis (~> 3.0)
rqrcode
rspec-rails
rubocop
sass-rails
sidekiq (< 5)
sidekiq-cron (~> 0.4.0)
simplecov
sinatra
slack-notifier (~> 1.5)
spring
sprockets
sprockets-es6
stripe (~> 1.57)
therubyracer
turbolinks (~> 5.0.0)
uglifier (>= 1.3.0)
webmock
will_paginate-bootstrap (~> 1.0)
RUBY VERSION
ruby 2.3.3p222
BUNDLED WITH
1.13.6