{"action":"created","issue":{"url":"https://api.github.com/repos/ErwinM/acts_as_tenant/issues/97","labels_url":"https://api.github.com/repos/ErwinM/acts_as_tenant/issues/97/labels{/name}","comments_url":"https://api.github.com/repos/ErwinM/acts_as_tenant/issues/97/comments","events_url":"https://api.github.com/repos/ErwinM/acts_as_tenant/issues/97/events","html_url":"https://github.com/ErwinM/acts_as_tenant/pull/97","id":52440277,"number":97,"title":"Mongoid compatibility","user":{"login":"iangreenleaf","id":78887,"avatar_url":"https://avatars.githubusercontent.com/u/78887?v=3","gravatar_id":"","url":"https://api.github.com/users/iangreenleaf","html_url":"https://github.com/iangreenleaf","followers_url":"https://api.github.com/users/iangreenleaf/followers","following_url":"https://api.github.com/users/iangreenleaf/following{/other_user}","gists_url":"https://api.github.com/users/iangreenleaf/gists{/gist_id}","starred_url":"https://api.github.com/users/iangreenleaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iangreenleaf/subscriptions","organizations_url":"https://api.github.com/users/iangreenleaf/orgs","repos_url":"https://api.github.com/users/iangreenleaf/repos","events_url":"https://api.github.com/users/iangreenleaf/events{/privacy}","received_events_url":"https://api.github.com/users/iangreenleaf/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2014-12-19T02:05:47Z","updated_at":"2015-01-25T17:21:14Z","closed_at":"2015-01-25T17:15:48Z","pull_request":{"url":"https://api.github.com/repos/ErwinM/acts_as_tenant/pulls/97","html_url":"https://github.com/ErwinM/acts_as_tenant/pull/97","diff_url":"https://github.com/ErwinM/acts_as_tenant/pull/97.diff","patch_url":"https://github.com/ErwinM/acts_as_tenant/pull/97.patch"},"body":"Since this plugin is mostly based on the ActiveModel interface, it doesn't take a ton of work to integrate it with an alternative to ActiveRecord like Mongoid. Most of the problems I encountered were little things, like:\r\n\r\n1. Not requiring active_record automatically - if Rails is using it, it should already be present.\r\n2. Not assuming that model classes will follow the ActiveRecord inheritance scheme.\r\n\r\nWith these changes, I have basic multitenancy working with Mongoid. My models declare scope like this:\r\n\r\n```ruby\r\nclass Comment\r\n  include Mongoid::Document\r\n  include ActsAsTenant::ModelExtensions\r\n  belongs_to :tenant\r\n  acts_as_tenant :tenant\r\nend\r\n```\r\n\r\nRelated: #10."},"comment":{"url":"https://api.github.com/repos/ErwinM/acts_as_tenant/issues/comments/71381970","html_url":"https://github.com/ErwinM/acts_as_tenant/pull/97#issuecomment-71381970","issue_url":"https://api.github.com/repos/ErwinM/acts_as_tenant/issues/97","id":71381970,"user":{"login":"ErwinM","id":451731,"avatar_url":"https://avatars.githubusercontent.com/u/451731?v=3","gravatar_id":"","url":"https://api.github.com/users/ErwinM","html_url":"https://github.com/ErwinM","followers_url":"https://api.github.com/users/ErwinM/followers","following_url":"https://api.github.com/users/ErwinM/following{/other_user}","gists_url":"https://api.github.com/users/ErwinM/gists{/gist_id}","starred_url":"https://api.github.com/users/ErwinM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ErwinM/subscriptions","organizations_url":"https://api.github.com/users/ErwinM/orgs","repos_url":"https://api.github.com/users/ErwinM/repos","events_url":"https://api.github.com/users/ErwinM/events{/privacy}","received_events_url":"https://api.github.com/users/ErwinM/received_events","type":"User","site_admin":false},"created_at":"2015-01-25T17:21:14Z","updated_at":"2015-01-25T17:21:14Z","body":"Thx for this. Looks good to me. Fair bit of work as well to rewire the tests as well! Could you add a few lines in the read me on how this works with mongoid?\r\n\r\n"}}