{"action":"created","issue":{"url":"https://api.github.com/repos/RolifyCommunity/rolify/issues/310","labels_url":"https://api.github.com/repos/RolifyCommunity/rolify/issues/310/labels{/name}","comments_url":"https://api.github.com/repos/RolifyCommunity/rolify/issues/310/comments","events_url":"https://api.github.com/repos/RolifyCommunity/rolify/issues/310/events","html_url":"https://github.com/RolifyCommunity/rolify/issues/310","id":54006554,"number":310,"title":"Regression starting 3.5.0 - can't add roles","user":{"login":"dhampik","id":586400,"avatar_url":"https://avatars.githubusercontent.com/u/586400?v=3","gravatar_id":"","url":"https://api.github.com/users/dhampik","html_url":"https://github.com/dhampik","followers_url":"https://api.github.com/users/dhampik/followers","following_url":"https://api.github.com/users/dhampik/following{/other_user}","gists_url":"https://api.github.com/users/dhampik/gists{/gist_id}","starred_url":"https://api.github.com/users/dhampik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhampik/subscriptions","organizations_url":"https://api.github.com/users/dhampik/orgs","repos_url":"https://api.github.com/users/dhampik/repos","events_url":"https://api.github.com/users/dhampik/events{/privacy}","received_events_url":"https://api.github.com/users/dhampik/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/RolifyCommunity/rolify/labels/3.x","name":"3.x","color":"99cc11"},{"url":"https://api.github.com/repos/RolifyCommunity/rolify/labels/High+Priority","name":"High Priority","color":"e11d21"},{"url":"https://api.github.com/repos/RolifyCommunity/rolify/labels/Regression","name":"Regression","color":"fad8c7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-01-11T21:52:43Z","updated_at":"2015-01-14T09:51:53Z","closed_at":"2015-01-14T09:31:44Z","body":"First, I used rolify v 3.5.1\r\nI added it to Gemfile\r\n~~~\r\nbundle install\r\nrails g rolify Role\r\nbin/rake db:migrate\r\nbin/rails console\r\nLoading development environment (Rails 4.2.0)\r\n2.2.0 :001 > user = User.find(1)\r\n  User Load (0.2ms)  SELECT  \"users\".* FROM \"users\" WHERE \"users\".\"id\" = ? LIMIT 1  [[\"id\", 1]]\r\n => #<User id: 1, username: \"test\", crypted_password: \"xxx\", created_at: \"2015-01-11 09:11:09\", updated_at: \"2015-01-11 09:11:09\", remember_me_token: \"xxx\", remember_me_token_expires_at: \"2015-01-18 16:43:09\"> \r\n2.2.0 :002 > user.roles\r\n  Role Load (0.2ms)  SELECT \"roles\".* FROM \"roles\" INNER JOIN \"users_roles\" ON \"roles\".\"id\" = \"users_roles\".\"role_id\" WHERE \"users_roles\".\"user_id\" = ?  [[\"user_id\", 1]]\r\n => #<ActiveRecord::Associations::CollectionProxy []> \r\n2.2.0 :003 > user.add_role :admin\r\n  Role Load (0.2ms)  SELECT  \"roles\".* FROM \"roles\" WHERE \"roles\".\"name\" = ? AND \"roles\".\"resource_type\" IS NULL AND \"roles\".\"resource_id\" IS NULL  ORDER BY \"roles\".\"id\" ASC LIMIT 1  [[\"name\", \"admin\"]]\r\n   (0.1ms)  begin transaction\r\n   (0.1ms)  rollback transaction\r\n  HABTM_Roles Load (0.1ms)  SELECT \"users_roles\".* FROM \"users_roles\" WHERE \"users_roles\".\"user_id\" = ?  [[\"user_id\", 1]]\r\n => #<Role id: nil, name: \"admin\", resource_id: nil, resource_type: nil, created_at: nil, updated_at: nil> \r\n2.2.0 :004 > user.roles\r\n => #<ActiveRecord::Associations::CollectionProxy []> \r\n# we have a problem here!\r\n~~~\r\n\r\nThen I reverted everything (including config and role model and user model), did the same with rolify v 3.4.1 and it worked well! Fix it please"},"comment":{"url":"https://api.github.com/repos/RolifyCommunity/rolify/issues/comments/69892547","html_url":"https://github.com/RolifyCommunity/rolify/issues/310#issuecomment-69892547","issue_url":"https://api.github.com/repos/RolifyCommunity/rolify/issues/310","id":69892547,"user":{"login":"lesterchan","id":355829,"avatar_url":"https://avatars.githubusercontent.com/u/355829?v=3","gravatar_id":"","url":"https://api.github.com/users/lesterchan","html_url":"https://github.com/lesterchan","followers_url":"https://api.github.com/users/lesterchan/followers","following_url":"https://api.github.com/users/lesterchan/following{/other_user}","gists_url":"https://api.github.com/users/lesterchan/gists{/gist_id}","starred_url":"https://api.github.com/users/lesterchan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lesterchan/subscriptions","organizations_url":"https://api.github.com/users/lesterchan/orgs","repos_url":"https://api.github.com/users/lesterchan/repos","events_url":"https://api.github.com/users/lesterchan/events{/privacy}","received_events_url":"https://api.github.com/users/lesterchan/received_events","type":"User","site_admin":false},"created_at":"2015-01-14T09:51:53Z","updated_at":"2015-01-14T09:51:53Z","body":"@andradei 3.5.1 has the same problem as well"}}