Skip to content

Commit

Permalink
Changeset returns HashWithIndifferentAccess
Browse files Browse the repository at this point in the history
  • Loading branch information
edtsech committed Aug 23, 2011
1 parent 44b117c commit 3c61978
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/paper_trail/version.rb
Expand Up @@ -84,7 +84,7 @@ def reify(options = {})
def changeset
if self.class.column_names.include? 'object_changes'
if changes = object_changes
YAML::load(changes)
HashWithIndifferentAccess[YAML::load(changes)]
else
{}
end
Expand Down
4 changes: 4 additions & 0 deletions test/unit/model_test.rb
Expand Up @@ -109,6 +109,10 @@ class HasPaperTrailModelTest < ActiveSupport::TestCase
assert_equal ({'name' => ['Henry', 'Harry']}), @widget.versions.last.changeset
end

should 'return changes with indifferent access' do
assert_equal (['Henry', 'Harry']), @widget.versions.last.changeset[:name]
end

if defined?(ActiveRecord::IdentityMap) && ActiveRecord::IdentityMap.respond_to?(:without)
should 'not clobber the IdentityMap when reifying' do
module ActiveRecord::IdentityMap
Expand Down

0 comments on commit 3c61978

Please sign in to comment.