historiqueux 0.0.8 → 0.0.9
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.
- checksums.yaml +4 -4
- data/app/controllers/historiqueux/history_controller.rb +20 -2
- data/lib/historiqueux/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc6637c6dc1298dd874deaf84c73d116d11ee43f
|
4
|
+
data.tar.gz: f45527e52b6f39db9a235f36aa3484a60d78b8e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfc20ffa2df4b7c039c676ae598c2b2488f444ef37e06d58464a69c863740c22a24dcebd3530c6e218d5c2958e2d7c3f12f4bdca553883a464153faff96ac801
|
7
|
+
data.tar.gz: 0201c26bffcd29bb878776facda56593cf666d1f5b5ac3fb72afe7c73b7ef846c3201ef84f0cbd06ebcf5b63fb450e67446600a6c9f2f2b6afcb807757c5b3d4
|
@@ -9,7 +9,6 @@ module Historiqueux
|
|
9
9
|
if resource.respond_to?('versions')
|
10
10
|
@history = resource.versions
|
11
11
|
@parent_div = params[:parent_div]
|
12
|
-
|
13
12
|
@relations = @resourceKlass.reflect_on_all_associations.map { |r| "#{r.name}" }.reject { |i| i=='versions' }
|
14
13
|
end
|
15
14
|
|
@@ -30,12 +29,17 @@ module Historiqueux
|
|
30
29
|
|
31
30
|
if @relation_resourceKlass
|
32
31
|
|
33
|
-
|
32
|
+
relations = @relation_resourceKlass.reflect_on_all_associations
|
33
|
+
cleaned_relations_array = remove_polymorphic_relations(relations)
|
34
|
+
@relations = cleaned_relations_array.map { |r| {:name => r.name,
|
35
|
+
:parent => r.active_record.to_s,
|
36
|
+
:klass => r.klass } }.reject { |i| i[:name]=='versions' }
|
34
37
|
|
35
38
|
@history_relations = {}
|
36
39
|
@relation_resource_list.each do |rr|
|
37
40
|
@history_relations.store(rr.id, rr.versions)
|
38
41
|
end
|
42
|
+
|
39
43
|
end
|
40
44
|
|
41
45
|
end
|
@@ -46,6 +50,20 @@ module Historiqueux
|
|
46
50
|
|
47
51
|
end
|
48
52
|
|
53
|
+
def remove_polymorphic_relations(relations)
|
54
|
+
cleaned_array = []
|
55
|
+
relations.each do |relation|
|
56
|
+
unless relation.options.empty?
|
57
|
+
unless relation.options[:polymorphic]
|
58
|
+
cleaned_array << relation
|
59
|
+
end
|
60
|
+
else
|
61
|
+
cleaned_array << relation
|
62
|
+
end
|
63
|
+
end
|
64
|
+
cleaned_array
|
65
|
+
end
|
66
|
+
|
49
67
|
|
50
68
|
def show
|
51
69
|
|
data/lib/historiqueux/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: historiqueux
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Groupe Fungo inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|