mongoid-history 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/lib/mongoid/history/trackable.rb +5 -2
- data/mongoid-history.gemspec +1 -1
- data/spec/integration/integration_spec.rb +1 -1
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -86,7 +86,7 @@ Here is a quick example on how to use this plugin. For more details, please look
|
|
86
86
|
comment.undo! @user
|
87
87
|
|
88
88
|
# undo versions 1 - 4
|
89
|
-
comment.undo! @user, :from =>
|
89
|
+
comment.undo! @user, :from => 4, :to => 1
|
90
90
|
|
91
91
|
# undo last 3 versions
|
92
92
|
comment.undo! @user, :last => 3
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.7
|
@@ -96,13 +96,16 @@ module Mongoid::History
|
|
96
96
|
if options_or_version.is_a? Hash
|
97
97
|
options = options_or_version
|
98
98
|
if options[:from] && options[:to]
|
99
|
-
|
99
|
+
lower = options[:from] >= options[:to] ? options[:to] : options[:from]
|
100
|
+
upper = options[:from] < options[:to] ? options[:to] : options[:from]
|
101
|
+
versions = history_tracks.where( :version.in => (lower .. upper).to_a )
|
100
102
|
elsif options[:last]
|
101
|
-
versions = history_tracks.limit(options[:last])
|
103
|
+
versions = history_tracks.limit( options[:last] )
|
102
104
|
else
|
103
105
|
raise "Invalid options, please specify (:from / :to) keys or :last key."
|
104
106
|
end
|
105
107
|
else
|
108
|
+
options_or_version = options_or_version.to_a if options_or_version.is_a?(Range)
|
106
109
|
version = options_or_version || self.attributes[history_trackable_options[:version_field]]
|
107
110
|
version = [ version ].flatten
|
108
111
|
versions = history_tracks.where(:version.in => version)
|
data/mongoid-history.gemspec
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: mongoid-history
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Aaron Qian
|
@@ -167,7 +167,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
167
167
|
requirements:
|
168
168
|
- - ">="
|
169
169
|
- !ruby/object:Gem::Version
|
170
|
-
hash:
|
170
|
+
hash: -460469172984094198
|
171
171
|
segments:
|
172
172
|
- 0
|
173
173
|
version: "0"
|