naranya_ecm-sdk 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea0998e99cb07c88fd0e848be0c22cd4a5a4a819
|
4
|
+
data.tar.gz: 66abcbeff7670f31910337d152c6422b8a36ed14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fafd50c83e14296b89eafd626eef4c60be7e318a44dad6eb65ec9842cecb55696d05f6aa6e528e00663937341d14dcd2083651ddb46b1492048955c8a9b7be8a
|
7
|
+
data.tar.gz: ebaf50c25bec1094c1a334402693cabda2a2d17b6d787d4045c5687602b3a6e90c32ee2b06d4572997d888ff1a0f4286f20bd0934fee5ff3f9145828ae680ee3
|
@@ -7,6 +7,7 @@ module NaranyaEcm::Behaviors
|
|
7
7
|
included do
|
8
8
|
self.site = NaranyaEcm.options.site
|
9
9
|
before_save :normalize_attributes
|
10
|
+
after_save :reload
|
10
11
|
end
|
11
12
|
|
12
13
|
def normalize_attributes
|
@@ -16,5 +17,6 @@ module NaranyaEcm::Behaviors
|
|
16
17
|
.keys.each { |attribute_name| self.attributes.delete attribute_name }
|
17
18
|
|
18
19
|
end
|
20
|
+
|
19
21
|
end
|
20
22
|
end
|
@@ -3,7 +3,7 @@ require 'active_resource'
|
|
3
3
|
module NaranyaEcm::Models
|
4
4
|
class Content < ::ActiveResource::Base
|
5
5
|
|
6
|
-
|
6
|
+
include ActiveModel::Dirty
|
7
7
|
|
8
8
|
include NaranyaEcm::Behaviors::Resourceable
|
9
9
|
|
@@ -41,7 +41,19 @@ module NaranyaEcm::Models
|
|
41
41
|
if NaranyaEcm.options[:extra_attributes] && NaranyaEcm.options[:extra_attributes][:content]
|
42
42
|
NaranyaEcm.options[:extra_attributes][:content].each { |key, val| attribute key, val }
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
schema_attrs = self.schema.keys.map(&:to_sym)
|
48
|
+
define_attribute_methods(*schema_attrs)
|
49
|
+
schema_attrs.each do |attr_sym|
|
50
|
+
# getter:
|
51
|
+
define_method(attr_sym) { @attributes[attr_sym] }
|
52
|
+
# setter:
|
53
|
+
define_method("#{attr_sym}=".to_sym) do |value|
|
54
|
+
self.send "#{attr_sym}_will_change!".to_sym unless value == @attributes[attr_sym]
|
55
|
+
@attributes[attr_sym] = value
|
56
|
+
end
|
45
57
|
end
|
46
58
|
|
47
59
|
delegate :title, to: :title_translations
|
@@ -56,6 +68,16 @@ module NaranyaEcm::Models
|
|
56
68
|
|
57
69
|
include NaranyaEcm::Behaviors::Timestampable
|
58
70
|
|
71
|
+
before_save :keywords_array!
|
72
|
+
|
73
|
+
def keywords_array!
|
74
|
+
unless self.attributes[:keywords].is_a?(Array)
|
75
|
+
self.attributes[:keywords] = if self.attributes[:keywords]=='' then []
|
76
|
+
else [self.attributes[:keywords]]
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
59
81
|
#include NaranyaEcm::Lifecycles::ContentLifecycle
|
60
82
|
|
61
83
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: naranya_ecm-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Quintanilla
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|