{"action":"created","issue":{"url":"https://api.github.com/repos/fatfreecrm/fat_free_crm/issues/399","labels_url":"https://api.github.com/repos/fatfreecrm/fat_free_crm/issues/399/labels{/name}","comments_url":"https://api.github.com/repos/fatfreecrm/fat_free_crm/issues/399/comments","events_url":"https://api.github.com/repos/fatfreecrm/fat_free_crm/issues/399/events","html_url":"https://github.com/fatfreecrm/fat_free_crm/issues/399","id":53725920,"number":399,"title":"NoMethodError (undefined method `each' for nil:NilClass) when run as an engine","user":{"login":"steveyken","id":149198,"avatar_url":"https://avatars.githubusercontent.com/u/149198?v=3","gravatar_id":"","url":"https://api.github.com/users/steveyken","html_url":"https://github.com/steveyken","followers_url":"https://api.github.com/users/steveyken/followers","following_url":"https://api.github.com/users/steveyken/following{/other_user}","gists_url":"https://api.github.com/users/steveyken/gists{/gist_id}","starred_url":"https://api.github.com/users/steveyken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steveyken/subscriptions","organizations_url":"https://api.github.com/users/steveyken/orgs","repos_url":"https://api.github.com/users/steveyken/repos","events_url":"https://api.github.com/users/steveyken/events{/privacy}","received_events_url":"https://api.github.com/users/steveyken/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/fatfreecrm/fat_free_crm/labels/rails4","name":"rails4","color":"eb6420"}],"state":"closed","locked":false,"assignee":{"login":"warp","id":10120,"avatar_url":"https://avatars.githubusercontent.com/u/10120?v=3","gravatar_id":"","url":"https://api.github.com/users/warp","html_url":"https://github.com/warp","followers_url":"https://api.github.com/users/warp/followers","following_url":"https://api.github.com/users/warp/following{/other_user}","gists_url":"https://api.github.com/users/warp/gists{/gist_id}","starred_url":"https://api.github.com/users/warp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/warp/subscriptions","organizations_url":"https://api.github.com/users/warp/orgs","repos_url":"https://api.github.com/users/warp/repos","events_url":"https://api.github.com/users/warp/events{/privacy}","received_events_url":"https://api.github.com/users/warp/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-01-08T08:28:40Z","updated_at":"2015-01-19T09:30:42Z","closed_at":"2015-01-19T09:30:42Z","body":"I get an error accessing the dashboard when running Fat Free CRM as an engine.\r\n\r\nI've created an app to help test Fat Free CRM in engine mode.\r\n\r\nSteps to reproduce:\r\n\r\n    git clone https://github.com/fatfreecrm/ffcrm_app41.git\r\n    bundle install\r\n    rake db:create\r\n    rake db:migrate\r\n    rake ffcrm:demo:load\r\n    bin/rails s\r\n\r\nNow goto http://localhost:3000 and login as username `aaron` password `aaron`\r\n\r\nGet the following error on accessing home page.\r\n\r\n    NoMethodError (undefined method `each' for nil:NilClass):\r\n      activerecord (4.1.0) lib/active_record/associations/preloader/association.rb:87:in `block in associated_records_by_owner'\r\n      activerecord (4.1.0) lib/active_record/associations/preloader/association.rb:86:in `each'\r\n      activerecord (4.1.0) lib/active_record/associations/preloader/association.rb:86:in `associated_records_by_owner'\r\n      activerecord (4.1.0) lib/active_record/associations/preloader/singular_association.rb:9:in `preload'\r\n      activerecord (4.1.0) lib/active_record/associations/preloader/association.rb:20:in `run'\r\n      activerecord (4.1.0) lib/active_record/associations/preloader.rb:136:in `block (2 levels) in preloaders_for_one'\r\n      activerecord (4.1.0) lib/active_record/associations/preloader.rb:134:in `each'\r\n      activerecord (4.1.0) lib/active_record/associations/preloader.rb:134:in `map'\r\n      activerecord (4.1.0) lib/active_record/associations/preloader.rb:134:in `block in preloaders_for_one'\r\n      activerecord (4.1.0) lib/active_record/associations/preloader.rb:133:in `each'\r\n      activerecord (4.1.0) lib/active_record/associations/preloader.rb:133:in `flat_map'\r\n      activerecord (4.1.0) lib/active_record/associations/preloader.rb:133:in `preloaders_for_one'\r\n      activerecord (4.1.0) lib/active_record/associations/preloader.rb:117:in `preloaders_for_hash'\r\n      activerecord (4.1.0) lib/active_record/associations/preloader.rb:104:in `preloaders_on'\r\n      activerecord (4.1.0) lib/active_record/associations/preloader.rb:94:in `block in preload'\r\n      activerecord (4.1.0) lib/active_record/associations/preloader.rb:93:in `each'\r\n      activerecord (4.1.0) lib/active_record/associations/preloader.rb:93:in `flat_map'\r\n      activerecord (4.1.0) lib/active_record/associations/preloader.rb:93:in `preload'\r\n      activerecord (4.1.0) lib/active_record/relation.rb:609:in `block in exec_queries'\r\n      activerecord (4.1.0) lib/active_record/relation.rb:608:in `each'\r\n      activerecord (4.1.0) lib/active_record/relation.rb:608:in `exec_queries'\r\n      activerecord (4.1.0) lib/active_record/relation.rb:487:in `load'\r\n      activerecord (4.1.0) lib/active_record/relation.rb:231:in `to_a'\r\n      /home/steve/.rvm/gems/ruby-2.1.1/bundler/gems/fat_free_crm-a3dc3930701c/app/models/polymorphic/version.rb:64:in `visible_to'\r\n      activerecord (4.1.0) lib/active_record/relation/delegation.rb:94:in `public_send'\r\n      activerecord (4.1.0) lib/active_record/relation/delegation.rb:94:in `block in method_missing'\r\n      activerecord (4.1.0) lib/active_record/relation.rb:286:in `scoping'\r\n      activerecord (4.1.0) lib/active_record/relation/delegation.rb:94:in `method_missing'\r\n      /home/steve/.rvm/gems/ruby-2.1.1/bundler/gems/fat_free_crm-a3dc3930701c/app/controllers/home_controller.rb:100:in `get_activities'\r\n      /home/steve/.rvm/gems/ruby-2.1.1/bundler/gems/fat_free_crm-a3dc3930701c/app/controllers/home_controller.rb:12:in `index'\r\n"},"comment":{"url":"https://api.github.com/repos/fatfreecrm/fat_free_crm/issues/comments/70466010","html_url":"https://github.com/fatfreecrm/fat_free_crm/issues/399#issuecomment-70466010","issue_url":"https://api.github.com/repos/fatfreecrm/fat_free_crm/issues/399","id":70466010,"user":{"login":"warp","id":10120,"avatar_url":"https://avatars.githubusercontent.com/u/10120?v=3","gravatar_id":"","url":"https://api.github.com/users/warp","html_url":"https://github.com/warp","followers_url":"https://api.github.com/users/warp/followers","following_url":"https://api.github.com/users/warp/following{/other_user}","gists_url":"https://api.github.com/users/warp/gists{/gist_id}","starred_url":"https://api.github.com/users/warp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/warp/subscriptions","organizations_url":"https://api.github.com/users/warp/orgs","repos_url":"https://api.github.com/users/warp/repos","events_url":"https://api.github.com/users/warp/events{/privacy}","received_events_url":"https://api.github.com/users/warp/received_events","type":"User","site_admin":false},"created_at":"2015-01-19T09:30:42Z","updated_at":"2015-01-19T09:30:42Z","body":"Interesting the rails 4.2 branch I was testing against does not have this issue so lets merge in rails 4.2 and run with that."}}