diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-06-17 21:41:50 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-06-17 21:41:50 +0000 |
commit | 46252b5bb858a1f2b87cc8646f3a59f935c58061 (patch) | |
tree | 47d016a74967ae7fac18b711dcf7c8a998730d9d /lib/puppet/rails | |
parent | 6084e1a0efa2165e5cb10fff9ef0b06c1560f9c0 (diff) | |
download | puppet-46252b5bb858a1f2b87cc8646f3a59f935c58061.tar.gz puppet-46252b5bb858a1f2b87cc8646f3a59f935c58061.tar.xz puppet-46252b5bb858a1f2b87cc8646f3a59f935c58061.zip |
All rails and language tests now pass again. All of the rails tests should now be in the rails/ directory, and I have modified resource translation so that it always converts single-member arrays to singe values, which means the rails collection does not need to worry about it.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2597 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/rails')
-rw-r--r-- | lib/puppet/rails/resource.rb | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/puppet/rails/resource.rb b/lib/puppet/rails/resource.rb index 2f58681ab..0163394b1 100644 --- a/lib/puppet/rails/resource.rb +++ b/lib/puppet/rails/resource.rb @@ -35,7 +35,7 @@ class Puppet::Rails::Resource < ActiveRecord::Base # returns a hash of param_names.name => [param_values] def get_params_hash(values = nil) values ||= param_values.find(:all, :include => :param_name) - return values.inject({}) do | hash, value | + values.inject({}) do | hash, value | hash[value.param_name.name] ||= [] hash[value.param_name.name] << value hash @@ -69,12 +69,15 @@ class Puppet::Rails::Resource < ActiveRecord::Base end def parameters - return self.param_values.find(:all, - :include => :param_name).inject({}) do |hash, pvalue| - hash[pvalue.param_name.name] ||= [] - hash[pvalue.param_name.name] << pvalue.value - hash + result = get_params_hash + result.each do |param, value| + if value.is_a?(Array) + result[param] = value.collect { |v| v.value } + else + result[param] = value.value + end end + result end def ref |