This commit is contained in:
parent
95a50ae6b8
commit
0359704751
|
@ -1,5 +1,8 @@
|
||||||
## 3.0.1 (Unreleased)
|
## 3.0.1 (Unreleased)
|
||||||
|
|
||||||
|
- [#328](https://github.com/airblade/paper_trail/pull/328) / [#326](https://github.com/airblade/paper_trail/issues/326)/
|
||||||
|
[#307](https://github.com/airblade/paper_trail/issues/307) - `Model.paper_trail_enabled_for_model?` and
|
||||||
|
`model_instance.without_versioning` is now thread-safe.
|
||||||
- [#316](https://github.com/airblade/paper_trail/issues/316) - `user_for_paper_trail` should default to `current_user.try(:id)`
|
- [#316](https://github.com/airblade/paper_trail/issues/316) - `user_for_paper_trail` should default to `current_user.try(:id)`
|
||||||
instead of `current_user` (if `current_user` is defined).
|
instead of `current_user` (if `current_user` is defined).
|
||||||
- [#313](https://github.com/airblade/paper_trail/pull/313) - Make the `Rails::Controller` helper compatible with
|
- [#313](https://github.com/airblade/paper_trail/pull/313) - Make the `Rails::Controller` helper compatible with
|
||||||
|
@ -44,11 +47,11 @@
|
||||||
## 2.7.2
|
## 2.7.2
|
||||||
|
|
||||||
- [#228](https://github.com/airblade/paper_trail/issues/228) - Refactored default `user_for_paper_trail` method implementation
|
- [#228](https://github.com/airblade/paper_trail/issues/228) - Refactored default `user_for_paper_trail` method implementation
|
||||||
so that `current_user` only gets invoked if it is defined.
|
so that `current_user` only gets invoked if it is defined.
|
||||||
- [#219](https://github.com/airblade/paper_trail/pull/219) - Fixed issue where attributes stored with `nil` value might not get
|
- [#219](https://github.com/airblade/paper_trail/pull/219) - Fixed issue where attributes stored with `nil` value might not get
|
||||||
reified properly depending on the way the serializer worked.
|
reified properly depending on the way the serializer worked.
|
||||||
- [#213](https://github.com/airblade/paper_trail/issues/213) - Added a `version_limit` option to the `PaperTrail::Config` options
|
- [#213](https://github.com/airblade/paper_trail/issues/213) - Added a `version_limit` option to the `PaperTrail::Config` options
|
||||||
that can be used to restrict the number of versions PaperTrail will store per object instance.
|
that can be used to restrict the number of versions PaperTrail will store per object instance.
|
||||||
- [#187](https://github.com/airblade/paper_trail/pull/187) - Confirmed JRuby support.
|
- [#187](https://github.com/airblade/paper_trail/pull/187) - Confirmed JRuby support.
|
||||||
- [#174](https://github.com/airblade/paper_trail/pull/174) - The `event` field on the versions table can now be customized.
|
- [#174](https://github.com/airblade/paper_trail/pull/174) - The `event` field on the versions table can now be customized.
|
||||||
|
|
||||||
|
|
|
@ -203,9 +203,13 @@ module PaperTrail
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def paper_trail_enabled_for_model?
|
||||||
|
self.class.paper_trail_enabled_for_model?
|
||||||
|
end
|
||||||
|
|
||||||
# Executes the given method or block without creating a new version.
|
# Executes the given method or block without creating a new version.
|
||||||
def without_versioning(method = nil)
|
def without_versioning(method = nil)
|
||||||
paper_trail_was_enabled = self.class.paper_trail_enabled_for_model?
|
paper_trail_was_enabled = self.paper_trail_enabled_for_model?
|
||||||
self.class.paper_trail_off!
|
self.class.paper_trail_off!
|
||||||
method ? method.to_proc.call(self) : yield
|
method ? method.to_proc.call(self) : yield
|
||||||
ensure
|
ensure
|
||||||
|
@ -334,7 +338,7 @@ module PaperTrail
|
||||||
end
|
end
|
||||||
|
|
||||||
def paper_trail_switched_on?
|
def paper_trail_switched_on?
|
||||||
PaperTrail.enabled? && PaperTrail.enabled_for_controller? && self.class.paper_trail_enabled_for_model?
|
PaperTrail.enabled? && PaperTrail.enabled_for_controller? && self.paper_trail_enabled_for_model?
|
||||||
end
|
end
|
||||||
|
|
||||||
def save_version?
|
def save_version?
|
||||||
|
|
|
@ -27,10 +27,10 @@ describe Widget do
|
||||||
describe :paper_trail_off! do
|
describe :paper_trail_off! do
|
||||||
it { should respond_to(:paper_trail_off!) }
|
it { should respond_to(:paper_trail_off!) }
|
||||||
|
|
||||||
it 'should set the `paper_trail_enabled_for_model` to `false`' do
|
it 'should set the `paper_trail_enabled_for_model?` to `false`' do
|
||||||
subject.paper_trail_enabled_for_model.should be_true
|
subject.paper_trail_enabled_for_model?.should be_true
|
||||||
subject.paper_trail_off!
|
subject.paper_trail_off!
|
||||||
subject.paper_trail_enabled_for_model.should be_false
|
subject.paper_trail_enabled_for_model?.should be_false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -54,10 +54,10 @@ describe Widget do
|
||||||
|
|
||||||
it { should respond_to(:paper_trail_on!) }
|
it { should respond_to(:paper_trail_on!) }
|
||||||
|
|
||||||
it 'should set the `paper_trail_enabled_for_model` to `true`' do
|
it 'should set the `paper_trail_enabled_for_model?` to `true`' do
|
||||||
subject.paper_trail_enabled_for_model.should be_false
|
subject.paper_trail_enabled_for_model?.should be_false
|
||||||
subject.paper_trail_on!
|
subject.paper_trail_on!
|
||||||
subject.paper_trail_enabled_for_model.should be_true
|
subject.paper_trail_enabled_for_model?.should be_true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue