{"action":"created","issue":{"url":"https://api.github.com/repos/activeadmin/activeadmin/issues/3764","labels_url":"https://api.github.com/repos/activeadmin/activeadmin/issues/3764/labels{/name}","comments_url":"https://api.github.com/repos/activeadmin/activeadmin/issues/3764/comments","events_url":"https://api.github.com/repos/activeadmin/activeadmin/issues/3764/events","html_url":"https://github.com/activeadmin/activeadmin/issues/3764","id":55594417,"number":3764,"title":"batch actions on a model with default_scope","user":{"login":"Vizvamitra","id":5035283,"avatar_url":"https://avatars.githubusercontent.com/u/5035283?v=3","gravatar_id":"","url":"https://api.github.com/users/Vizvamitra","html_url":"https://github.com/Vizvamitra","followers_url":"https://api.github.com/users/Vizvamitra/followers","following_url":"https://api.github.com/users/Vizvamitra/following{/other_user}","gists_url":"https://api.github.com/users/Vizvamitra/gists{/gist_id}","starred_url":"https://api.github.com/users/Vizvamitra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Vizvamitra/subscriptions","organizations_url":"https://api.github.com/users/Vizvamitra/orgs","repos_url":"https://api.github.com/users/Vizvamitra/repos","events_url":"https://api.github.com/users/Vizvamitra/events{/privacy}","received_events_url":"https://api.github.com/users/Vizvamitra/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/activeadmin/activeadmin/labels/Bug","name":"Bug","color":"e10c02"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2015-01-27T09:30:15Z","updated_at":"2015-01-29T22:24:30Z","closed_at":null,"body":"In my app I have a model with default scope. In some cases admin user can through activeadmin create records of this model that are outside the default scope. The problem is, in this case when admin tries to perform a default batch action :destroy on these records, activeadmin can't find them.\r\n\r\nHere is a string in [:destroy batch action sources](https://github.com/activeadmin/activeadmin/blob/abe59fdc6cd73803bd94e6b8403b9df9ec11d947/lib/active_admin/batch_actions/resource_extension.rb#L70) that performs find and destroy:\r\n\r\n     active_admin_config.resource_class.find(selected_ids).each { |r| r.destroy }\r\n\r\nwhere `active_admin_config.resource_class` is my model. So it performs MyModel.find(ids), and records with those ids are not in the default scope, and I get RecordNotFound error.\r\n\r\nIt there anything I can do with that without writing 15 lines of code that redefines :destroy batch action just to change that one line (`active_admin_config.resource_class` => `MyModel.unscoped`)"},"comment":{"url":"https://api.github.com/repos/activeadmin/activeadmin/issues/comments/72116816","html_url":"https://github.com/activeadmin/activeadmin/issues/3764#issuecomment-72116816","issue_url":"https://api.github.com/repos/activeadmin/activeadmin/issues/3764","id":72116816,"user":{"login":"Fivell","id":120269,"avatar_url":"https://avatars.githubusercontent.com/u/120269?v=3","gravatar_id":"","url":"https://api.github.com/users/Fivell","html_url":"https://github.com/Fivell","followers_url":"https://api.github.com/users/Fivell/followers","following_url":"https://api.github.com/users/Fivell/following{/other_user}","gists_url":"https://api.github.com/users/Fivell/gists{/gist_id}","starred_url":"https://api.github.com/users/Fivell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fivell/subscriptions","organizations_url":"https://api.github.com/users/Fivell/orgs","repos_url":"https://api.github.com/users/Fivell/repos","events_url":"https://api.github.com/users/Fivell/events{/privacy}","received_events_url":"https://api.github.com/users/Fivell/received_events","type":"User","site_admin":false},"created_at":"2015-01-29T22:24:30Z","updated_at":"2015-01-29T22:24:30Z","body":"I will try to improve in this branch https://github.com/Fivell/activeadmin/tree/collection_method_refactoring"}}