Skip to content

Commit

Permalink
Update CHANGELOG and cleanup changes from PR #399
Browse files Browse the repository at this point in the history
  • Loading branch information
batter committed Jul 25, 2014
1 parent d3255e2 commit 6421f1f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
## 3.1.0 (Unreleased)

- [#399](https://github.com/airblade/paper_trail/pull/399) - Add `:dup` argument for options hash to `reify` which forces a
new model instance.
- [#398](https://github.com/airblade/paper_trail/pull/398) - Only require the `RSpec` helper if `RSpec::Core` is required.
- [#394](https://github.com/airblade/paper_trail/pull/394) - Add RSpec matcher `have_a_version_with` for easier testing.

## 3.0.3

##### Breaking Change: If you use a custom initializer for PaperTrail in conjunction with Rails, you will need to add this line of code to the beginning of it:
##### Breaking change: if you use a custom initializer for PaperTrail in conjunction with Rails, you will need to add this line of code to the beginning of it:
```ruby
PaperTrail::Rails::Engine.eager_load!
```
Expand Down
2 changes: 1 addition & 1 deletion lib/paper_trail/version_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def reify(options = {})
# `item_type` will be the base class, not the actual subclass.
# If `type` is present but empty, the class is the base class.

if item && ! options[:dup]
if item && options[:dup] != true
model = item
# Look for attributes that exist in the model and not in this version. These attributes should be set to nil.
(model.attribute_names - attrs.keys).each { |k| attrs[k] = nil }
Expand Down
6 changes: 3 additions & 3 deletions spec/models/widget_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
widget.update_attributes(:name => 'Elizabeth')
end

context "reverting a change" do
context "default behavior (no `options[:dup]` option passed in)" do
let(:reified_widget) { widget.versions[1].reify }

it "should return the appropriate originator" do
Expand All @@ -123,8 +123,8 @@
end
end

context "creating a new instance" do
let(:reified_widget) { widget.versions[1].reify(dup: true) }
context "creating a new instance (`options[:dup] == true`)" do
let(:reified_widget) { widget.versions[1].reify(:dup => true) }

it "should return the appropriate originator" do
reified_widget.originator.should == orig_name
Expand Down

0 comments on commit 6421f1f

Please sign in to comment.