Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added without_default_scope option #301

Merged
merged 4 commits into from Feb 1, 2016

Conversation

Projects
None yet
4 participants
@westonganger
Copy link
Contributor

commented Jan 30, 2016

I added an option to skip the default_scope. This makes the gem much more versatile and not susceptible to all the problems that come with default_scope.

@jhawthorn

This comment has been minimized.

Copy link
Collaborator

commented Jan 31, 2016

Thank you @westonganger. I love this.

Is it possible to add a test?

westonganger added some commits Feb 1, 2016

@westonganger

This comment has been minimized.

Copy link
Contributor Author

commented Feb 1, 2016

I have added a test for this.

jhawthorn added a commit that referenced this pull request Feb 1, 2016

Merge pull request #301 from westonganger/rails4
Added without_default_scope option

@jhawthorn jhawthorn merged commit 6844662 into rubysherpas:rails4 Feb 1, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@jhawthorn

This comment has been minimized.

Copy link
Collaborator

commented Feb 1, 2016

Awesome. Thanks.

@reicheltd

This comment has been minimized.

Copy link

commented Feb 24, 2016

Works thx. Had to move from 2.1 to current rails4 branch.

@jrochkind

This comment has been minimized.

Copy link

commented Apr 18, 2016

Hi, I could really use this feature, will a paranoia 2.2 with it included be released anytime soon?

@jrochkind

This comment has been minimized.

Copy link

commented Apr 18, 2016

FWIW, for others coming across this, here's how I monkey-patched it in, roughly, in the specific class where I needed it...

    acts_as_paranoid without_default_scope: true

  paranoia_spec = Gem.loaded_specs["paranoia"]
  if paranoia_spec.version < Gem::Version.new('2.2')
    default_scopes.delete_if do |scope|
      scope.source_location.first.start_with? paranoia_spec.full_gem_path
    end
    class << self; alias_method :without_deleted, :paranoia_scope end
  end

@westonganger westonganger deleted the westonganger:rails4 branch May 25, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.