{"action":"created","issue":{"url":"https://api.github.com/repos/RolifyCommunity/rolify/issues/225","labels_url":"https://api.github.com/repos/RolifyCommunity/rolify/issues/225/labels{/name}","comments_url":"https://api.github.com/repos/RolifyCommunity/rolify/issues/225/comments","events_url":"https://api.github.com/repos/RolifyCommunity/rolify/issues/225/events","html_url":"https://github.com/RolifyCommunity/rolify/issues/225","id":26979263,"number":225,"title":"Rolify 3.4.0 adding role when calling has_role?","user":{"login":"adambarthelson","id":1851382,"avatar_url":"https://avatars.githubusercontent.com/u/1851382?v=3","gravatar_id":"","url":"https://api.github.com/users/adambarthelson","html_url":"https://github.com/adambarthelson","followers_url":"https://api.github.com/users/adambarthelson/followers","following_url":"https://api.github.com/users/adambarthelson/following{/other_user}","gists_url":"https://api.github.com/users/adambarthelson/gists{/gist_id}","starred_url":"https://api.github.com/users/adambarthelson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adambarthelson/subscriptions","organizations_url":"https://api.github.com/users/adambarthelson/orgs","repos_url":"https://api.github.com/users/adambarthelson/repos","events_url":"https://api.github.com/users/adambarthelson/events{/privacy}","received_events_url":"https://api.github.com/users/adambarthelson/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2014-02-05T17:08:18Z","updated_at":"2015-10-15T18:26:47Z","closed_at":"2015-10-15T18:26:47Z","body":"I've spent a few days trying to figure this out, but I've found that after an update from 3.2.0 to 3.4.0, whenever any of my after_create callbacks for the user call has_role?, it will add the role to the user as well.\r\n\r\nWith Rolify 3.4.0:\r\n\r\nIn an after_create method (this is called twice between 2 seperate methods): \r\n```\r\nif self.has_role? :coach\r\n   ...\r\nend\r\n```\r\nAfter the user is created, checking the roles I find:\r\n\r\n```\r\n>> user.roles\r\n \r\n=> [\r\n    [0] #<Role:0x007fde2e68f6f0> {\r\n                   :id => 2,\r\n                 :name => \"coach\",\r\n          :resource_id => nil,\r\n        :resource_type => nil,\r\n           :created_at => Wed, 22 Jan 2014 15:42:33 UTC +00:00,\r\n           :updated_at => Wed, 22 Jan 2014 15:42:33 UTC +00:00\r\n    },\r\n    [1] #<Role:0x007fde2e68efc0> {\r\n                   :id => 2,\r\n                 :name => \"coach\",\r\n          :resource_id => nil,\r\n        :resource_type => nil,\r\n           :created_at => Wed, 22 Jan 2014 15:42:33 UTC +00:00,\r\n           :updated_at => Wed, 22 Jan 2014 15:42:33 UTC +00:00\r\n    }\r\n]\r\n```\r\n\r\nWith Rolify 3.2.0:\r\n\r\nAfter user creation (correct behavior):\r\n\r\n```\r\n>> user.roles\r\n=> []\r\n```\r\n\r\nThis bug causes issues for other users who look to signup as other roles, as the views have elements that are only shown to users with specific roles.\r\n\r\nI'm locking my gem at 3.2.0 for now."},"comment":{"url":"https://api.github.com/repos/RolifyCommunity/rolify/issues/comments/148480707","html_url":"https://github.com/RolifyCommunity/rolify/issues/225#issuecomment-148480707","issue_url":"https://api.github.com/repos/RolifyCommunity/rolify/issues/225","id":148480707,"user":{"login":"EppO","id":6111,"avatar_url":"https://avatars.githubusercontent.com/u/6111?v=3","gravatar_id":"","url":"https://api.github.com/users/EppO","html_url":"https://github.com/EppO","followers_url":"https://api.github.com/users/EppO/followers","following_url":"https://api.github.com/users/EppO/following{/other_user}","gists_url":"https://api.github.com/users/EppO/gists{/gist_id}","starred_url":"https://api.github.com/users/EppO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EppO/subscriptions","organizations_url":"https://api.github.com/users/EppO/orgs","repos_url":"https://api.github.com/users/EppO/repos","events_url":"https://api.github.com/users/EppO/events{/privacy}","received_events_url":"https://api.github.com/users/EppO/received_events","type":"User","site_admin":false},"created_at":"2015-10-15T18:26:47Z","updated_at":"2015-10-15T18:26:47Z","body":"dup of #228 which includes a workaround"}}