Skip to content

Commit

Permalink
Update Discard + Paranoia gem installation
Browse files Browse the repository at this point in the history
  • Loading branch information
reidab committed May 31, 2018
1 parent 71ad18f commit cbacd95
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
15 changes: 12 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,18 @@ group :development, :test do
gem "awesome_print"
gem "timecop"

# to test the integration
gem "discard"
gem "paranoia"
# To test integrations

# Both the paranoia and discard integrations require Rails > 4.2
# Actually parsing the resolved rails version is complicated, so
# we're basing this on the incompatible Rails version strings from
# .travis.yml

unless ['~> 3.2.0', '~> 4.0.0', '~> 4.1.0'].include?(rails)
gem "discard"
gem "paranoia"
end

if RUBY_VERSION < "2.3.0"
gem "paper_trail", "< 9.0.0"
else
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,12 @@ Manually populating counter caches with dynamically over-written foreign keys (`

### Soft-deletes with `paranoia` or `discard`

This gem will keep counters correctly updated when using
[paranoia](https://github.com/rubysherpas/paranoia) or [discard](https://github.com/jhawthorn/discard) for soft-delete support. However, to ensure that counts are incremented after a
restore you have to make sure that the to set up soft deletion (via `acts_as_paranoid` or `include Discard::Model`) before the call to `counter_culture` in your model:
This gem will keep counters correctly updated in Rails 4.2 or later when using
[paranoia](https://github.com/rubysherpas/paranoia) or
[discard](https://github.com/jhawthorn/discard) for soft-delete support.
However, to ensure that counts are incremented after a restore you have
to make sure that the to set up soft deletion (via `acts_as_paranoid` or
`include Discard::Model`) before the call to `counter_culture` in your model:

#### Paranoia

Expand Down

0 comments on commit cbacd95

Please sign in to comment.