summaryrefslogtreecommitdiffstats
path: root/lib/puppet/rails
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/rails')
-rw-r--r--lib/puppet/rails/param_name.rb3
-rw-r--r--lib/puppet/rails/param_value.rb19
2 files changed, 20 insertions, 2 deletions
diff --git a/lib/puppet/rails/param_name.rb b/lib/puppet/rails/param_name.rb
index 1f633638e..d704693c4 100644
--- a/lib/puppet/rails/param_name.rb
+++ b/lib/puppet/rails/param_name.rb
@@ -12,8 +12,7 @@ class Puppet::Rails::ParamName < ActiveRecord::Base
hash[:value] = resource.param_values.find(:all, :conditions => [ "param_name_id = ?", self]).collect { |v| v.value }
if hash[:value].length == 1
hash[:value] = hash[:value].shift
- end
- if hash[:value].empty?
+ elsif hash[:value].empty?
hash[:value] = nil
end
Puppet::Parser::Resource::Param.new hash
diff --git a/lib/puppet/rails/param_value.rb b/lib/puppet/rails/param_value.rb
index f463608a6..a176413eb 100644
--- a/lib/puppet/rails/param_value.rb
+++ b/lib/puppet/rails/param_value.rb
@@ -1,6 +1,25 @@
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
end
# $Id$