blob: c90765ebb84a0b03542b2fd49afb9e202582d36a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
require 'puppet/util/rails/collection_merger'
class Puppet::Rails::ParamName < ActiveRecord::Base
include Puppet::Util::CollectionMerger
has_many :param_values, :dependent => :destroy
belongs_to :resource
def to_resourceparam(source)
hash = {}
hash[:name] = self.name.to_sym
hash[:source] = source
hash[:value] = self.param_values.find(:all).collect { |v| v.value }
if hash[:value].length == 1
hash[:value] = hash[:value].shift
end
if hash[:value].empty?
hash[:value] = nil
end
Puppet::Parser::Resource::Param.new hash
end
end
# $Id$
|