blob: fc00a43d4e0758e38dcdea5fc52a180d05a32e2e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
class Puppet::Rails::ParamValue < ActiveRecord::Base
belongs_to :param_name
belongs_to :resource
def value
val = self[:value]
if val =~ /^--- \!/
YAML.load(val)
else
val
end
end
# I could not find a cleaner way to handle making sure that resource references
# were consistently serialized and deserialized.
def value=(val)
if val.is_a?(Puppet::Parser::Resource::Reference)
self[:value] = YAML.dump(val)
else
self[:value] = val
end
end
def to_label
"#{self.param_name.name}"
end
end
|