{"action":"created","issue":{"url":"https://api.github.com/repos/contentful/contentful_rails/issues/18","repository_url":"https://api.github.com/repos/contentful/contentful_rails","labels_url":"https://api.github.com/repos/contentful/contentful_rails/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/contentful/contentful_rails/issues/18/comments","events_url":"https://api.github.com/repos/contentful/contentful_rails/issues/18/events","html_url":"https://github.com/contentful/contentful_rails/issues/18","id":171649691,"number":18,"title":"Concern with `eager_load!`","user":{"login":"richessler","id":7101910,"avatar_url":"https://avatars.githubusercontent.com/u/7101910?v=3","gravatar_id":"","url":"https://api.github.com/users/richessler","html_url":"https://github.com/richessler","followers_url":"https://api.github.com/users/richessler/followers","following_url":"https://api.github.com/users/richessler/following{/other_user}","gists_url":"https://api.github.com/users/richessler/gists{/gist_id}","starred_url":"https://api.github.com/users/richessler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richessler/subscriptions","organizations_url":"https://api.github.com/users/richessler/orgs","repos_url":"https://api.github.com/users/richessler/repos","events_url":"https://api.github.com/users/richessler/events{/privacy}","received_events_url":"https://api.github.com/users/richessler/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/contentful/contentful_rails/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-08-17T12:52:34Z","updated_at":"2016-08-19T12:39:45Z","closed_at":null,"body":"While adding the `contentful_rails` gem to my application I noticed it instantly bombed initialization and it was happening on load of a class which I dynamically load after initialization. \r\n\r\nIt was bombing because my `Rails.application.routes.url_helpers` haven't yet been defined and i traced it back to [line 28 of engine.rb](https://github.com/contentful/contentful_rails/blob/master/lib/contentful_rails/engine.rb#L28) where `Rails.application.eager_load!` is being called.  This is a concern for me because adjusting the existing code may prove to be more time costly than forking and making these adjustments. \r\n\r\nI followed the commit history and looked at the commit messages and comments within the code but they haven't been the most helpful.\r\n\r\nHow imperative is the eager_loading? I as soon as I remove this line my app is in tip top shape. I'd appreciate a little insight thanks!\r\n\r\n~~Off-topic additional question: [Line 52 of engine.rb](https://github.com/contentful/contentful_rails/blob/master/lib/contentful_rails/engine.rb#L52) appears to be replacing the `.json` mimetype completely for the entire application.  Am I completely wrong?~~\r\n\r\n**EDIT**\r\nJust saw #2 which answers this question. Perhaps I can assist.\r\n\r\nThanks in advance."},"comment":{"url":"https://api.github.com/repos/contentful/contentful_rails/issues/comments/241007467","html_url":"https://github.com/contentful/contentful_rails/issues/18#issuecomment-241007467","issue_url":"https://api.github.com/repos/contentful/contentful_rails/issues/18","id":241007467,"user":{"login":"richessler","id":7101910,"avatar_url":"https://avatars.githubusercontent.com/u/7101910?v=3","gravatar_id":"","url":"https://api.github.com/users/richessler","html_url":"https://github.com/richessler","followers_url":"https://api.github.com/users/richessler/followers","following_url":"https://api.github.com/users/richessler/following{/other_user}","gists_url":"https://api.github.com/users/richessler/gists{/gist_id}","starred_url":"https://api.github.com/users/richessler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richessler/subscriptions","organizations_url":"https://api.github.com/users/richessler/orgs","repos_url":"https://api.github.com/users/richessler/repos","events_url":"https://api.github.com/users/richessler/events{/privacy}","received_events_url":"https://api.github.com/users/richessler/received_events","type":"User","site_admin":false},"created_at":"2016-08-19T12:39:45Z","updated_at":"2016-08-19T12:39:45Z","body":"So a few things we discovered:\r\n\r\nYour above recommendations of the `to_prepare()` and `require: false` within the gem file got me passed the load issue and so the `eager_load!()` no longer was an issue, but what then was discovered is that that initializer chain within `engine.rb` doesn't get run with `require: false`. \r\n\r\nReferencing [this post by Yehuda Kats](http://stackoverflow.com/a/8454819/3573300) it's because the initialize process had already begun, so new initializers can't be triggered.\r\n\r\nLet me know if you have any other ideas. Thanks again!\r\n\r\n"}}
{"actor":{"display_login":"richessler"}}