{"action":"created","issue":{"url":"https://api.github.com/repos/ylosix/ylosix/issues/7","labels_url":"https://api.github.com/repos/ylosix/ylosix/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/ylosix/ylosix/issues/7/comments","events_url":"https://api.github.com/repos/ylosix/ylosix/issues/7/events","html_url":"https://github.com/ylosix/ylosix/pull/7","id":112985603,"number":7,"title":"Generate unique slugs in model scope","user":{"login":"arifkalayci","id":15126307,"avatar_url":"https://avatars.githubusercontent.com/u/15126307?v=3","gravatar_id":"","url":"https://api.github.com/users/arifkalayci","html_url":"https://github.com/arifkalayci","followers_url":"https://api.github.com/users/arifkalayci/followers","following_url":"https://api.github.com/users/arifkalayci/following{/other_user}","gists_url":"https://api.github.com/users/arifkalayci/gists{/gist_id}","starred_url":"https://api.github.com/users/arifkalayci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arifkalayci/subscriptions","organizations_url":"https://api.github.com/users/arifkalayci/orgs","repos_url":"https://api.github.com/users/arifkalayci/repos","events_url":"https://api.github.com/users/arifkalayci/events{/privacy}","received_events_url":"https://api.github.com/users/arifkalayci/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-23T09:27:50Z","updated_at":"2015-10-23T10:30:17Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ylosix/ylosix/pulls/7","html_url":"https://github.com/ylosix/ylosix/pull/7","diff_url":"https://github.com/ylosix/ylosix/pull/7.diff","patch_url":"https://github.com/ylosix/ylosix/pull/7.patch"},"body":""},"comment":{"url":"https://api.github.com/repos/ylosix/ylosix/issues/comments/150538225","html_url":"https://github.com/ylosix/ylosix/pull/7#issuecomment-150538225","issue_url":"https://api.github.com/repos/ylosix/ylosix/issues/7","id":150538225,"user":{"login":"ryanfox1985","id":1152728,"avatar_url":"https://avatars.githubusercontent.com/u/1152728?v=3","gravatar_id":"","url":"https://api.github.com/users/ryanfox1985","html_url":"https://github.com/ryanfox1985","followers_url":"https://api.github.com/users/ryanfox1985/followers","following_url":"https://api.github.com/users/ryanfox1985/following{/other_user}","gists_url":"https://api.github.com/users/ryanfox1985/gists{/gist_id}","starred_url":"https://api.github.com/users/ryanfox1985/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryanfox1985/subscriptions","organizations_url":"https://api.github.com/users/ryanfox1985/orgs","repos_url":"https://api.github.com/users/ryanfox1985/repos","events_url":"https://api.github.com/users/ryanfox1985/events{/privacy}","received_events_url":"https://api.github.com/users/ryanfox1985/received_events","type":"User","site_admin":false},"created_at":"2015-10-23T10:30:17Z","updated_at":"2015-10-23T10:30:17Z","body":"Hi,\r\ncan you modify your proposal adding:\r\n\r\nIf check_models any:\r\n```\r\ndef unique_slug(slug, check_models = [Category, Product, Tag])\r\n...\r\ncount = 0\r\ncheck_models.each do |model|\r\n   count += model.with_translations.where('slug like :slug', slug: slug).uniq(model).length\r\nend\r\n...\r\n```\r\n\r\nIf check_models empty:\r\n```\r\ncount = self.class.with_translations.where('slug like :slug', slug: slug).uniq(self.class).length\r\n```\r\nOptional:\r\n- if you want to use inject method."}}