active_metadata 0.8.8 → 0.8.9
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -1,11 +1,9 @@
|
|
1
|
-
|
2
|
-
I task di rake vengono invocati via il namespace app.
|
1
|
+
### Active Metadata
|
3
2
|
|
4
|
-
|
3
|
+
* Add notes and attachments to any AR model field.
|
4
|
+
* Trace the value chnages in the field history.
|
5
|
+
* Manage field changes concurrency.
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
* The install task should automount the engine as /active_metadata
|
9
|
-
* Migrations should be available to the rails app that mount the engine and not copied.
|
10
|
-
* Move the test db creation into before suite rspec callback and remove the migration from the db folder
|
7
|
+
|
8
|
+
The project comes from a bigger codebase refactoring and is still in heavy development stage. Use with care. API will possible change a lot in the future.
|
11
9
|
|
data/lib/active_metadata/base.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module ActiveMetadata
|
2
2
|
|
3
3
|
CONFIG = File.exists?('config/active_metadata.yml') ? YAML.load_file('config/active_metadata.yml')[Rails.env] : {}
|
4
|
-
CONFIG['cache_expires_in'] ||=
|
4
|
+
CONFIG['cache_expires_in'] ||= nil
|
5
5
|
CONFIG['cache_prefix'] ||= ""
|
6
6
|
|
7
7
|
def self.skip_history?
|
@@ -22,7 +22,7 @@ module ActiveMetadata::Persistence::Attachment
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def attachments_for(field, order_by="updated_at DESC")
|
25
|
-
Rails.cache.fetch(attachments_cache_key(field), :expires_in => ActiveMetadata::CONFIG['cache_expires_in'].minutes) do
|
25
|
+
Rails.cache.fetch(attachments_cache_key(field), :expires_in => ActiveMetadata::CONFIG['cache_expires_in'].try(:minutes)) do
|
26
26
|
fetch_attachments_for field, nil, order_by
|
27
27
|
end
|
28
28
|
end
|
@@ -97,7 +97,7 @@ module ActiveMetadata::Persistence::Attachment
|
|
97
97
|
|
98
98
|
def reload_attachments_cache_for field
|
99
99
|
#Rails.cache.clear
|
100
|
-
Rails.cache.write(attachments_cache_key(field), fetch_attachments_for(field), :expires_in => ActiveMetadata::CONFIG['cache_expires_in'].minutes)
|
100
|
+
Rails.cache.write(attachments_cache_key(field), fetch_attachments_for(field), :expires_in => ActiveMetadata::CONFIG['cache_expires_in'].try(:minutes))
|
101
101
|
end
|
102
102
|
|
103
103
|
def fetch_attachments_for(field, starred=nil, order_by="updated_at DESC")
|
@@ -17,7 +17,7 @@ module ActiveMetadata::Persistence::History
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def history_for field, order="created_at DESC"
|
20
|
-
Rails.cache.fetch(history_cache_key(field), :expires_in => ActiveMetadata::CONFIG['cache_expires_in'].minutes) do
|
20
|
+
Rails.cache.fetch(history_cache_key(field), :expires_in => ActiveMetadata::CONFIG['cache_expires_in'].try(:minutes)) do
|
21
21
|
fetch_histories_for field, order
|
22
22
|
end
|
23
23
|
end
|
@@ -46,7 +46,7 @@ module ActiveMetadata::Persistence::Note
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def notes_for(field, order_by="updated_at DESC")
|
49
|
-
Rails.cache.fetch(notes_cache_key(field), :expires_in => ActiveMetadata::CONFIG['cache_expires_in'].minutes) do
|
49
|
+
Rails.cache.fetch(notes_cache_key(field), :expires_in => ActiveMetadata::CONFIG['cache_expires_in'].try(:minutes)) do
|
50
50
|
fetch_notes_for field, nil, order_by
|
51
51
|
end
|
52
52
|
end
|
@@ -104,7 +104,7 @@ module ActiveMetadata::Persistence::Note
|
|
104
104
|
private
|
105
105
|
|
106
106
|
def reload_notes_cache_for field
|
107
|
-
Rails.cache.write(notes_cache_key(field), fetch_notes_for(field), :expires_in => ActiveMetadata::CONFIG['cache_expires_in'].minutes)
|
107
|
+
Rails.cache.write(notes_cache_key(field), fetch_notes_for(field), :expires_in => ActiveMetadata::CONFIG['cache_expires_in'].try(:minutes))
|
108
108
|
end
|
109
109
|
|
110
110
|
def fetch_notes_for(field, starred=nil, order_by="updated_at DESC")
|
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.8.
|
4
|
+
version: 0.8.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-02-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -277,7 +277,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
277
277
|
version: '0'
|
278
278
|
segments:
|
279
279
|
- 0
|
280
|
-
hash:
|
280
|
+
hash: -159705593394059220
|
281
281
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
282
282
|
none: false
|
283
283
|
requirements:
|
@@ -286,7 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
286
286
|
version: '0'
|
287
287
|
segments:
|
288
288
|
- 0
|
289
|
-
hash:
|
289
|
+
hash: -159705593394059220
|
290
290
|
requirements: []
|
291
291
|
rubyforge_project: active_metadata
|
292
292
|
rubygems_version: 1.8.24
|