{"action":"created","issue":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1012","labels_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1012/labels{/name}","comments_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1012/comments","events_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1012/events","html_url":"https://github.com/rails-api/active_model_serializers/issues/1012","id":95497032,"number":1012,"title":"Running Serializers with Rails Nginx and Unicorn","user":{"login":"sternhenri","id":3359083,"avatar_url":"https://avatars.githubusercontent.com/u/3359083?v=3","gravatar_id":"","url":"https://api.github.com/users/sternhenri","html_url":"https://github.com/sternhenri","followers_url":"https://api.github.com/users/sternhenri/followers","following_url":"https://api.github.com/users/sternhenri/following{/other_user}","gists_url":"https://api.github.com/users/sternhenri/gists{/gist_id}","starred_url":"https://api.github.com/users/sternhenri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sternhenri/subscriptions","organizations_url":"https://api.github.com/users/sternhenri/orgs","repos_url":"https://api.github.com/users/sternhenri/repos","events_url":"https://api.github.com/users/sternhenri/events{/privacy}","received_events_url":"https://api.github.com/users/sternhenri/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-16T18:34:54Z","updated_at":"2015-07-16T21:00:48Z","closed_at":null,"body":"Hey there,\r\n\r\nThis is a bit of a shot in the dark but I am having trouble running the gem on a server to customize our API's json returns. (**see below for where it is included in the app**).\r\n\r\nTo make a long story short, the gem works great on localhost, but somehow, when I deploy to a webserver using nginx/unicorn (with Capistrano 3.0), I run into errors in my Unicorn log and the client can't access the app.\r\n\r\nThis is the error I am getting: \r\n\r\n```\r\nE, [2015-07-16T17:38:46.737769 #12405] ERROR -- : uninitialized constant ActiveModel::Serializer (NameError)\r\n/home/.../releases/20150716172308/config/initializers/api_configs.rb:3:in `<top (required)>'\r\n/home/.../shared/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/engine.rb:652:in `block in load_config_initializer'\r\n```\r\n\r\nWhen I comment out that line from my initializer, I get an error with the serialization_scope setting in my application_controller.rb (Undefined Method: serialization_scope) and the code similarly doesn't run. I have also tried manually including in the application_controller.rb \r\n```\r\nInclude ActionController::Serialization\r\n```\r\nto no avail (I receive the error Uninitialized Constant ActionController::Serialization). This was recommended in other issues but, unfortunately, it did not solve my problem. \r\n\r\nI thought this meant the the gem wasn't getting pulled in properly on my server (perhaps given that it's pulled in directly from github), but that doesn't seem to be quite it. \r\n1) 'active_model_serializers-0.10.0.rc1' is in my gemset\r\n2) **in my rails console, my ActiveModel config (the line that's giving me an error) is working properly**: \r\n_With line in my api_configs:_\r\n```\r\nActiveModel::Serializer.config.adapter\r\n=> :json\r\n```\r\n_Without the line in my api_configs:_\r\n```\r\nActiveModel::Serializer.config.adapter\r\n=> :flatten_json\r\n```\r\n\r\nHas anybody seen this behavior before or know what I am doing wrong?\r\n\r\nThanks so much!\r\n\r\nHenri\r\n\r\n**_________**\r\n\r\nAMS inclusions in my code:\r\n\r\n*Gemfile*\r\n```\r\ngem 'active_model_serializers', github: \"rails-api/active_model_serializers\"\r\n```\r\n*initializer file*\r\n```\r\nActiveModel::Serializer.config.adapter = :json\r\n```\r\n*application_controller.rb*\r\n```\r\n  serialization_scope :view_context\r\n```\r\n*Model Files (example)*\r\n```\r\ndef active_model_serializer\r\n\tUserSerializer\r\nend\r\n```\r\n*Serializer Files (example)*\r\n```\r\nclass LinkSerializer < PostSerializer\r\n\tattributes :url\r\nend\r\n```"},"comment":{"url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/comments/122093495","html_url":"https://github.com/rails-api/active_model_serializers/issues/1012#issuecomment-122093495","issue_url":"https://api.github.com/repos/rails-api/active_model_serializers/issues/1012","id":122093495,"user":{"login":"zreitano","id":3478061,"avatar_url":"https://avatars.githubusercontent.com/u/3478061?v=3","gravatar_id":"","url":"https://api.github.com/users/zreitano","html_url":"https://github.com/zreitano","followers_url":"https://api.github.com/users/zreitano/followers","following_url":"https://api.github.com/users/zreitano/following{/other_user}","gists_url":"https://api.github.com/users/zreitano/gists{/gist_id}","starred_url":"https://api.github.com/users/zreitano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zreitano/subscriptions","organizations_url":"https://api.github.com/users/zreitano/orgs","repos_url":"https://api.github.com/users/zreitano/repos","events_url":"https://api.github.com/users/zreitano/events{/privacy}","received_events_url":"https://api.github.com/users/zreitano/received_events","type":"User","site_admin":false},"created_at":"2015-07-16T21:00:48Z","updated_at":"2015-07-16T21:00:48Z","body":"I have the same exact problem! Any help would be greatly appreciated. "}}