{"action":"created","issue":{"url":"https://api.github.com/repos/radar/paranoia/issues/253","labels_url":"https://api.github.com/repos/radar/paranoia/issues/253/labels{/name}","comments_url":"https://api.github.com/repos/radar/paranoia/issues/253/comments","events_url":"https://api.github.com/repos/radar/paranoia/issues/253/events","html_url":"https://github.com/radar/paranoia/issues/253","id":95756051,"number":253,"title":"Restore doesn't work with rails 3.2.11","user":{"login":"mlabarca","id":4587965,"avatar_url":"https://avatars.githubusercontent.com/u/4587965?v=3","gravatar_id":"","url":"https://api.github.com/users/mlabarca","html_url":"https://github.com/mlabarca","followers_url":"https://api.github.com/users/mlabarca/followers","following_url":"https://api.github.com/users/mlabarca/following{/other_user}","gists_url":"https://api.github.com/users/mlabarca/gists{/gist_id}","starred_url":"https://api.github.com/users/mlabarca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlabarca/subscriptions","organizations_url":"https://api.github.com/users/mlabarca/orgs","repos_url":"https://api.github.com/users/mlabarca/repos","events_url":"https://api.github.com/users/mlabarca/events{/privacy}","received_events_url":"https://api.github.com/users/mlabarca/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-17T22:20:02Z","updated_at":"2015-07-18T22:52:35Z","closed_at":null,"body":"Hi, first of all, I apologize if this issue is unnecessary, I'm still new to rails therefore I could've made a mistake on installation of this gem.  \r\n\r\nI couldn't get restore  to work with my rails version, using paranoia ver. 1.3.4 . After going through the code and some past issues such  as #37 it seems update_column still uses default_scope in my rails version. Thanks to the workaround mentioned in #37 so far I have this workaround initializer: \r\n```\r\nmodule Paranoia\r\n  # override\r\n  def restore!(opts = {})\r\n    ActiveRecord::Base.transaction do\r\n      run_callbacks(:restore) do\r\n        self.class.unscoped.update_all({deleted_at: nil}, self.class.primary_key => id)\r\n        restore_associated_records if opts[:recursive]\r\n      end\r\n    end\r\n  end\r\n  alias :restore :restore!\r\nend\r\n```\r\nI was wondering if there was a better workaround for this. I also think the readme for the rails 3 should mention this issue referencing the required rails ver. for restore to work as intended. It still is possible to restore a single record scoping the model, i.e. Client.with_deleted.restore(1), but this won't work for its associations using recursive: true. "},"comment":{"url":"https://api.github.com/repos/radar/paranoia/issues/comments/122602893","html_url":"https://github.com/radar/paranoia/issues/253#issuecomment-122602893","issue_url":"https://api.github.com/repos/radar/paranoia/issues/253","id":122602893,"user":{"login":"radar","id":2687,"avatar_url":"https://avatars.githubusercontent.com/u/2687?v=3","gravatar_id":"","url":"https://api.github.com/users/radar","html_url":"https://github.com/radar","followers_url":"https://api.github.com/users/radar/followers","following_url":"https://api.github.com/users/radar/following{/other_user}","gists_url":"https://api.github.com/users/radar/gists{/gist_id}","starred_url":"https://api.github.com/users/radar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radar/subscriptions","organizations_url":"https://api.github.com/users/radar/orgs","repos_url":"https://api.github.com/users/radar/repos","events_url":"https://api.github.com/users/radar/events{/privacy}","received_events_url":"https://api.github.com/users/radar/received_events","type":"User","site_admin":false},"created_at":"2015-07-18T22:52:35Z","updated_at":"2015-07-18T22:52:35Z","body":"Show me how I can reproduce this issue on a brand new app please.\n\n \n\n> On 19 Jul 2015, at 03:23, Mauricio Labarca <notifications@github.com> wrote:\n> \n> Hi, what I did was to soft delete a model instance that had a couple of depedant: destroy associations, and each had acts_as_paranoia activated. Soft deletion worked okay, with the parent instance being soft deleted and each chained association. Restoring the instance with something like Model.restore(id) failed and returned a not found error, and looking at the queries it seems the Where part of the Update query is using the altered default scope ( WHERE deleted_at = NULL) thus not updating anything.\n> \n> I ran the tests in the gem installation dir and got a bunch of failing tests related to restore: https://gist.github.com/mlabarca/8be7a1f45878be469a14\n> Also, here's my gemfile: \n> https://gist.github.com/mlabarca/6a864dd5abb000638ede\n> Hope that helps.\n> \n> —\n> Reply to this email directly or view it on GitHub.\n> \n"}}