{"action":"opened","issue":{"url":"https://api.github.com/repos/cerebris/jsonapi-resources/issues/378","labels_url":"https://api.github.com/repos/cerebris/jsonapi-resources/issues/378/labels{/name}","comments_url":"https://api.github.com/repos/cerebris/jsonapi-resources/issues/378/comments","events_url":"https://api.github.com/repos/cerebris/jsonapi-resources/issues/378/events","html_url":"https://github.com/cerebris/jsonapi-resources/issues/378","id":100521531,"number":378,"title":"Related source with `relation_name` breaks starting version 0.5.5","user":{"login":"apraditya","id":70412,"avatar_url":"https://avatars.githubusercontent.com/u/70412?v=3","gravatar_id":"","url":"https://api.github.com/users/apraditya","html_url":"https://github.com/apraditya","followers_url":"https://api.github.com/users/apraditya/followers","following_url":"https://api.github.com/users/apraditya/following{/other_user}","gists_url":"https://api.github.com/users/apraditya/gists{/gist_id}","starred_url":"https://api.github.com/users/apraditya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apraditya/subscriptions","organizations_url":"https://api.github.com/users/apraditya/orgs","repos_url":"https://api.github.com/users/apraditya/repos","events_url":"https://api.github.com/users/apraditya/events{/privacy}","received_events_url":"https://api.github.com/users/apraditya/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-12T11:23:31Z","updated_at":"2015-08-12T11:23:31Z","closed_at":null,"body":"Hey there,\r\n\r\nIf I have the following resource\r\n\r\n````\r\nclass PostResource < JSONAPI::Resource\r\n  has_many  :categories,   relation_name: 'internal_categories'\r\nend\r\n````\r\n\r\nand I have this in my route:\r\n\r\n````\r\n  jsonapi_resources :posts,   only: [:index, :show]\r\n  jsonapi_resources :categories,   only: [:index, :show]\r\n````\r\n\r\nI do have `CategoryResource` and it works fine since the first time I use this gem (0.4.4). When I upgraded to 0.5.5, I got  `Internal Server Error: undefined method 'categories'` error when accessing /api/v2/posts/1030/categories. Version 0.5.6 doesn't fix the issue. It is fine on 0.5.4\r\n\r\nI think it has something to do with `relation_type` on `ShowRelatedResourcesOperation#apply`. Here's the trackback:\r\n\r\n````\r\nInternal Server Error: undefined method `categories' for #<Post:0x007f8f47301280> /usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activemodel-4.2.3/lib/active_model/attribute_methods.rb:433:in `method_missing'\r\n/Users/apraditya/Projects/Client/clients-api/app/concerns/multi_step_model.rb:39:in `method_missing'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/acts_as_follower-0.2.1/lib/acts_as_follower/followable.rb:54:in `method_missing'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/pg_search-1.0.4/lib/pg_search.rb:83:in `method_missing'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jsonapi-resources-0.5.5/lib/jsonapi/resource.rb:115:in `public_send'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jsonapi-resources-0.5.5/lib/jsonapi/resource.rb:115:in `records_for'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jsonapi-resources-0.5.5/lib/jsonapi/operation.rb:161:in `records'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jsonapi-resources-0.5.5/lib/jsonapi/operation.rb:153:in `record_count'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jsonapi-resources-0.5.5/lib/jsonapi/operation.rb:168:in `pagination_params'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jsonapi-resources-0.5.5/lib/jsonapi/operation.rb:177:in `options'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jsonapi-resources-0.5.5/lib/jsonapi/operation.rb:188:in `apply'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jsonapi-resources-0.5.5/lib/jsonapi/active_record_operations_processor.rb:19:in `process_operation'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jsonapi-resources-0.5.5/lib/jsonapi/operations_processor.rb:53:in `block (5 levels) in process'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:84:in `run_callbacks'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jsonapi-resources-0.5.5/lib/jsonapi/operations_processor.rb:52:in `block (4 levels) in process'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:84:in `run_callbacks'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jsonapi-resources-0.5.5/lib/jsonapi/operations_processor.rb:50:in `block (3 levels) in process'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jsonapi-resources-0.5.5/lib/jsonapi/operations_processor.rb:45:in `each'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jsonapi-resources-0.5.5/lib/jsonapi/operations_processor.rb:45:in `block (2 levels) in process'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jsonapi-resources-0.5.5/lib/jsonapi/active_record_operations_processor.rb:10:in `transaction'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jsonapi-resources-0.5.5/lib/jsonapi/operations_processor.rb:41:in `block in process'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:84:in `run_callbacks'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jsonapi-resources-0.5.5/lib/jsonapi/operations_processor.rb:40:in `process'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jsonapi-resources-0.5.5/lib/jsonapi/acts_as_resource_controller.rb:158:in `process_request_operations'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/jsonapi-resources-0.5.5/lib/jsonapi/acts_as_resource_controller.rb:54:in `get_related_resources'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/abstract_controller/base.rb:198:in `process_action'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/action_controller/metal/rendering.rb:10:in `process_action'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/abstract_controller/callbacks.rb:20:in `block in process_action'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:115:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:115:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:553:in `block (2 levels) in compile'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:503:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:503:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:88:in `run_callbacks'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/abstract_controller/callbacks.rb:19:in `process_action'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/action_controller/metal/rescue.rb:29:in `process_action'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.3/lib/active_support/notifications.rb:164:in `block in instrument'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.3/lib/active_support/notifications/instrumenter.rb:20:in `instrument'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.3/lib/active_support/notifications.rb:164:in `instrument'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/action_controller/metal/instrumentation.rb:30:in `process_action'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activerecord-4.2.3/lib/active_record/railties/controller_runtime.rb:18:in `process_action'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/abstract_controller/base.rb:137:in `process'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionview-4.2.3/lib/action_view/rendering.rb:30:in `process'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/action_controller/metal.rb:196:in `dispatch'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/action_controller/metal.rb:237:in `block in action'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/routing/route_set.rb:76:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/routing/route_set.rb:76:in `dispatch'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/routing/route_set.rb:45:in `serve'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/journey/router.rb:43:in `block in serve'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/journey/router.rb:30:in `each'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/journey/router.rb:30:in `serve'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/routing/route_set.rb:821:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/bundler/gems/apipie-rails-becc75b5f026/lib/apipie/static_dispatcher.rb:65:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/bundler/gems/apipie-rails-becc75b5f026/lib/apipie/extractor/recorder.rb:132:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/warden-1.2.3/lib/warden/manager.rb:35:in `block in call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/warden-1.2.3/lib/warden/manager.rb:34:in `catch'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/warden-1.2.3/lib/warden/manager.rb:34:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/etag.rb:24:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/conditionalget.rb:25:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/params_parser.rb:27:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activerecord-4.2.3/lib/active_record/query_cache.rb:36:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:377:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:84:in `run_callbacks'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/callbacks.rb:27:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/reloader.rb:73:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/remote_ip.rb:78:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rollbar-2.1.1/lib/rollbar/middleware/rails/rollbar.rb:24:in `block in call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rollbar-2.1.1/lib/rollbar.rb:801:in `scoped'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rollbar-2.1.1/lib/rollbar/middleware/rails/rollbar.rb:22:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rollbar-2.1.1/lib/rollbar/middleware/rails/show_exceptions.rb:22:in `call_with_rollbar'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/web-console-2.1.3/lib/web_console/middleware.rb:37:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/rack/logger.rb:38:in `call_app'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/rack/logger.rb:20:in `block in call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:68:in `block in tagged'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:26:in `tagged'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:68:in `tagged'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/rack/logger.rb:20:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/request_store-1.1.0/lib/request_store/middleware.rb:8:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/request_id.rb:21:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/runtime.rb:18:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.3/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/lock.rb:17:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/actionpack-4.2.3/lib/action_dispatch/middleware/static.rb:116:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-cors-0.4.0/lib/rack/cors.rb:80:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/engine.rb:518:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/application.rb:165:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/lock.rb:17:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/content_length.rb:15:in `call'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:88:in `service'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'\r\n/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'\r\nCompleted 500 Internal Server Error in 228ms (Views: 0.7ms | ActiveRecord: 15.0ms)\r\n\r\n````"}}