diff options
Diffstat (limited to 'lib/puppet/rails/param_value.rb')
-rw-r--r-- | lib/puppet/rails/param_value.rb | 19 |
1 files changed, 19 insertions, 0 deletions
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$ |