{"action":"closed","issue":{"url":"https://api.github.com/repos/suweller/mongoid-autoinc/issues/18","labels_url":"https://api.github.com/repos/suweller/mongoid-autoinc/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/suweller/mongoid-autoinc/issues/18/comments","events_url":"https://api.github.com/repos/suweller/mongoid-autoinc/issues/18/events","html_url":"https://github.com/suweller/mongoid-autoinc/issues/18","id":24551169,"number":18,"title":"Inheriting classes that use the same counter?","user":{"login":"jmuheim","id":1814983,"avatar_url":"https://avatars.githubusercontent.com/u/1814983?v=3","gravatar_id":"","url":"https://api.github.com/users/jmuheim","html_url":"https://github.com/jmuheim","followers_url":"https://api.github.com/users/jmuheim/followers","following_url":"https://api.github.com/users/jmuheim/following{/other_user}","gists_url":"https://api.github.com/users/jmuheim/gists{/gist_id}","starred_url":"https://api.github.com/users/jmuheim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmuheim/subscriptions","organizations_url":"https://api.github.com/users/jmuheim/orgs","repos_url":"https://api.github.com/users/jmuheim/repos","events_url":"https://api.github.com/users/jmuheim/events{/privacy}","received_events_url":"https://api.github.com/users/jmuheim/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2013-12-19T11:39:13Z","updated_at":"2015-12-01T08:51:59Z","closed_at":"2015-12-01T08:51:59Z","body":"We have the following class structure:\r\n\r\n- Parent\r\n  - ChildA\r\n  - ChildB\r\n\r\nThey are all stored in the same collection. We want to have an incrementing counter that is shared between all those classes, but your implementation doesn't support this as you use the `model_name` as namespace:\r\n\r\n```ruby\r\n    def increment!(field, options)\r\n      scope_key = options[:scope] ? evaluate_scope(options[:scope]) : nil\r\n      seed = options[:seed]\r\n      write_attribute(\r\n          field.to_sym, Mongoid::Autoinc::Incrementor.new(\r\n          self.class.model_name, field, scope_key, seed).inc # Use collection_name here!\r\n      )\r\n    end\r\n```\r\n\r\nWould it be possible to use `collection_name` instead? Thanks."}}