active_metadata 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
data/db/test.sqlite3
CHANGED
Binary file
|
@@ -32,7 +32,7 @@ end
|
|
32
32
|
|
33
33
|
When /^afterwards I delete the note on the field "([^"]*)"$/ do |field|
|
34
34
|
note = @document.notes_for(field.to_sym).first
|
35
|
-
@document.
|
35
|
+
@document.delete_note(note.id)
|
36
36
|
end
|
37
37
|
|
38
38
|
When /^creating a new attachment on the "([^"]*)" field with name "([^"]*)"$/ do |field, filename|
|
@@ -44,7 +44,7 @@ end
|
|
44
44
|
|
45
45
|
When /^deleting the attachment on the "([^"]*)" field with name "([^"]*)"$/ do |field, filename|
|
46
46
|
@attachment = @document.attachments_for(field.to_sym).last
|
47
|
-
@document.
|
47
|
+
@document.delete_attachment(@attachment.id)
|
48
48
|
end
|
49
49
|
|
50
50
|
When /^updating the attachment on the "([^"]*)" field with name "([^"]*)"$/ do |field, filename|
|
@@ -52,7 +52,7 @@ When /^updating the attachment on the "([^"]*)" field with name "([^"]*)"$/ do |
|
|
52
52
|
file = File.expand_path("../../supports/#{filename}", __FILE__)
|
53
53
|
updated_file = Rack::Test::UploadedFile.new(file, "plain/text")
|
54
54
|
|
55
|
-
@document.
|
55
|
+
@document.update_attachment(@attachment.id, updated_file)
|
56
56
|
end
|
57
57
|
# Then ##########################################################
|
58
58
|
Then /^([^"]*) alert should be found in the inbox of the user$/ do |number|
|
@@ -13,9 +13,9 @@ module ActiveMetadata::Persistence::ActiveRecord::Attachment
|
|
13
13
|
self.send(:send_notification, field, "", attachment.attach.original_filename, :attachment_message, current_user_id)
|
14
14
|
end
|
15
15
|
|
16
|
-
def attachments_for(field)
|
16
|
+
def attachments_for(field, order_by="attach_updated_at DESC")
|
17
17
|
Rails.cache.fetch(attachments_cache_key(field), :expires_in => ActiveMetadata::CONFIG['cache_expires_in'].minutes) do
|
18
|
-
fetch_attachments_for field
|
18
|
+
fetch_attachments_for field, nil, order_by
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -69,10 +69,10 @@ module ActiveMetadata::Persistence::ActiveRecord::Attachment
|
|
69
69
|
Rails.cache.write(attachments_cache_key(field),fetch_attachments_for(field), :expires_in => ActiveMetadata::CONFIG['cache_expires_in'].minutes )
|
70
70
|
end
|
71
71
|
|
72
|
-
def fetch_attachments_for
|
72
|
+
def fetch_attachments_for(field, starred=nil, order_by="attach_updated_at DESC")
|
73
73
|
conditions = {:document_class => metadata_class, :document_id => metadata_id,:label => field}
|
74
74
|
conditions[:starred] = starred if !starred.nil?
|
75
|
-
Attachment.all(:conditions => conditions , :order =>
|
75
|
+
Attachment.all(:conditions => conditions , :order => order_by)
|
76
76
|
end
|
77
77
|
|
78
78
|
end
|
@@ -25,9 +25,9 @@ module ActiveMetadata::Persistence::ActiveRecord::Note
|
|
25
25
|
self.send(:send_notification, n.label, old_value, note, :note_message, current_user_id)
|
26
26
|
end
|
27
27
|
|
28
|
-
def notes_for(field)
|
28
|
+
def notes_for(field, order_by="updated_at DESC")
|
29
29
|
Rails.cache.fetch(notes_cache_key(field), :expires_in => ActiveMetadata::CONFIG['cache_expires_in'].minutes) do
|
30
|
-
fetch_notes_for field
|
30
|
+
fetch_notes_for field, nil, order_by
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -72,12 +72,12 @@ module ActiveMetadata::Persistence::ActiveRecord::Note
|
|
72
72
|
Rails.cache.write(notes_cache_key(field),fetch_notes_for(field), :expires_in => ActiveMetadata::CONFIG['cache_expires_in'].minutes )
|
73
73
|
end
|
74
74
|
|
75
|
-
def fetch_notes_for(field, starred=nil)
|
75
|
+
def fetch_notes_for(field, starred=nil, order_by="updated_at DESC")
|
76
76
|
conditions = {:label => field, :document_class => metadata_class, :document_id => metadata_id}
|
77
77
|
unless starred.nil?
|
78
78
|
conditions[:starred] = starred
|
79
79
|
end
|
80
|
-
Note.all(:conditions => conditions, :order =>
|
80
|
+
Note.all(:conditions => conditions, :order => order_by)
|
81
81
|
end
|
82
82
|
|
83
83
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_metadata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-11-
|
13
|
+
date: 2011-11-23 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec-rails
|
17
|
-
requirement: &
|
17
|
+
requirement: &70096914062140 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70096914062140
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: sqlite3
|
28
|
-
requirement: &
|
28
|
+
requirement: &70096914044460 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70096914044460
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: sqlite3-ruby
|
39
|
-
requirement: &
|
39
|
+
requirement: &70096914044040 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70096914044040
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: cucumber
|
50
|
-
requirement: &
|
50
|
+
requirement: &70096914043500 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70096914043500
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: ci_reporter
|
61
|
-
requirement: &
|
61
|
+
requirement: &70096914042720 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: '0'
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *70096914042720
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rails
|
72
|
-
requirement: &
|
72
|
+
requirement: &70096914041920 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - =
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
version: 3.0.1
|
78
78
|
type: :runtime
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *70096914041920
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: activerecord
|
83
|
-
requirement: &
|
83
|
+
requirement: &70096914040940 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - =
|
@@ -88,10 +88,10 @@ dependencies:
|
|
88
88
|
version: 3.0.1
|
89
89
|
type: :runtime
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *70096914040940
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: paperclip
|
94
|
-
requirement: &
|
94
|
+
requirement: &70096914039660 !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
97
97
|
- - ! '>='
|
@@ -99,7 +99,7 @@ dependencies:
|
|
99
99
|
version: '0'
|
100
100
|
type: :runtime
|
101
101
|
prerelease: false
|
102
|
-
version_requirements: *
|
102
|
+
version_requirements: *70096914039660
|
103
103
|
description: First implementation will write metadata on mongodb
|
104
104
|
email:
|
105
105
|
- acampolonghi@gmail.com
|
@@ -188,18 +188,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
188
188
|
- - ! '>='
|
189
189
|
- !ruby/object:Gem::Version
|
190
190
|
version: '0'
|
191
|
-
segments:
|
192
|
-
- 0
|
193
|
-
hash: -4250317635104951696
|
194
191
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
192
|
none: false
|
196
193
|
requirements:
|
197
194
|
- - ! '>='
|
198
195
|
- !ruby/object:Gem::Version
|
199
196
|
version: '0'
|
200
|
-
segments:
|
201
|
-
- 0
|
202
|
-
hash: -4250317635104951696
|
203
197
|
requirements: []
|
204
198
|
rubyforge_project: active_metadata
|
205
199
|
rubygems_version: 1.8.10
|
@@ -227,3 +221,4 @@ test_files:
|
|
227
221
|
- spec/support/section.rb
|
228
222
|
- spec/support/user.rb
|
229
223
|
- spec/support/watcher_notifier.rb
|
224
|
+
has_rdoc:
|