joshbuddy-has_many_versions 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -122,3 +122,11 @@ And what would the world look like if Jasper Fforde hadn't written anything?
122
122
  => 8
123
123
  jasper.books
124
124
  => []
125
+
126
+ Of course, it's always fun to reminisce
127
+ jasper.books.at(3)
128
+ => [#<Book id: 27, author_id: 3, initial_version: 2, version: 5, name: "The Eyre Affair">,
129
+ #<Book id: 28, author_id: 3, initial_version: 2, version: 5, name: "Something Rotten">,
130
+ #<Book id: 29, author_id: 3, initial_version: 3, version: 4, name: "Lost in a Good Book">]
131
+ jasper.books
132
+ => []
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 6
2
+ :patch: 7
3
3
  :major: 0
4
4
  :minor: 0
@@ -112,5 +112,9 @@ module HasManyVersions
112
112
  end
113
113
 
114
114
  end
115
+
116
+ def at(target_version)
117
+ proxy_reflection.klass.find(:all, :conditions => ["#{proxy_reflection.primary_key_name} = ? and initial_version <= ? and version >= ?", proxy_owner.id, target_version, target_version])
118
+ end
115
119
 
116
120
  end
@@ -56,6 +56,8 @@ describe "HasManyVersions rollbacks" do
56
56
  jasper.books.collect(&:name).should == [eyre_affair.name, shades_of_grey.name, eyre_affair2.name, shades_of_grey2.name, eyre_affair3.name]
57
57
  jasper.books.rollback(3)
58
58
  jasper.books.collect(&:name).should == [eyre_affair.name, shades_of_grey.name, eyre_affair2.name, shades_of_grey2.name]
59
+ jasper.books.at(2).collect(&:name).should == [eyre_affair.name, shades_of_grey.name]
60
+ jasper.books.collect(&:name).should == [eyre_affair.name, shades_of_grey.name, eyre_affair2.name, shades_of_grey2.name]
59
61
  end
60
62
 
61
63
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: joshbuddy-has_many_versions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Hull
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-22 00:00:00 -07:00
12
+ date: 2009-04-30 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15