Skip to content

Commit

Permalink
Simplifying query example on the README [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
batter committed Nov 25, 2013
1 parent 08a0849 commit 7083584
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -706,7 +706,7 @@ end
Why would you do this? In this example, `author_id` is an attribute of `Article` and PaperTrail will store it anyway in a serialized form in the `object` column of the `version` record. But let's say you wanted to pull out all versions for a particular author; without the metadata you would have to deserialize (reify) each `version` object to see if belonged to the author in question. Clearly this is inefficient. Using the metadata you can find just those versions you want:

```ruby
PaperTrail::Version.all(:conditions => ['author_id = ?', author_id])
PaperTrail::Version.where(:author_id => author_id)
```

Note you can pass a symbol as a value in the `meta` hash to signal a method to call.
Expand Down

0 comments on commit 7083584

Please sign in to comment.