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 Aug 29, 2014
1 parent 53e6337 commit 541456a
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
Expand Up @@ -5,6 +5,8 @@
PaperTrail::Rails::Engine.eager_load!
```

- [#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.
- [#347](https://github.com/airblade/paper_trail/pull/347) - Autoload `ActiveRecord` models in via a `Rails::Engine` when
Expand All @@ -20,7 +22,7 @@ PaperTrail::Rails::Engine.eager_load!
*This version was yanked from RubyGems and has been replaced by version `3.0.4`, which is identical but does not eager load
in the `PaperTrail::Version` class through a `Rails::Engine` when the gem is used on Rails since it was causing issues for some users.*

##### 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 @@ -134,7 +134,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 @@ -115,7 +115,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 @@ -127,8 +127,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 541456a

Please sign in to comment.