custom-attributes 0.0.1 → 0.1.0
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.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
@@ -32,6 +32,18 @@ class ActiveRecord::CustomAttributes::CustomAttributeList
|
|
32
32
|
loaded_attributes.each(&:save)
|
33
33
|
end
|
34
34
|
|
35
|
+
def defined_attribute_types
|
36
|
+
(extra_attribute_types.keys + defined_attributes.keys).uniq
|
37
|
+
end
|
38
|
+
|
39
|
+
def defined_labels_for type
|
40
|
+
results = []
|
41
|
+
(defined_attributes[type.to_sym] || {}).each do |key, options|
|
42
|
+
results << human_label_for(type, key)
|
43
|
+
end
|
44
|
+
results
|
45
|
+
end
|
46
|
+
|
35
47
|
def supported_attribute_types
|
36
48
|
return @supported_attribute_types if @supported_attribute_types
|
37
49
|
standard_attribute_types = {}
|
@@ -75,6 +75,14 @@ describe "Custom attributes of a person" do
|
|
75
75
|
@person.custom_attributes.telephone_value_of(:private).should == "06 28 61 06 28"
|
76
76
|
end
|
77
77
|
|
78
|
+
it "should provide defined field types" do
|
79
|
+
@person.custom_attributes.defined_attribute_types.should =~ [:date, :email, :telephone]
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should provide defined labels" do
|
83
|
+
@person.custom_attributes.defined_labels_for(:date).should =~ ["Born on", "Wed on", "Died on"]
|
84
|
+
end
|
85
|
+
|
78
86
|
|
79
87
|
end
|
80
88
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: custom-attributes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 0
|
9
8
|
- 1
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matthijs Groen
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-06 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|