# File lib/puppet/rails/resource.rb, line 218
218:     def to_resource(scope)
219:         hash = self.attributes
220:         hash["type"] = hash["restype"]
221:         hash.delete("restype")
222: 
223:         # FIXME At some point, we're going to want to retain this information
224:         # for logging and auditing.
225:         hash.delete("host_id")
226:         hash.delete("updated_at")
227:         hash.delete("source_file_id")
228:         hash.delete("created_at")
229:         hash.delete("id")
230:         hash.each do |p, v|
231:             hash.delete(p) if v.nil?
232:         end
233:         hash[:scope] = scope
234:         hash[:source] = scope.source
235:         hash[:params] = []
236:         names = []
237:         self.param_names.each do |pname|
238:             # We can get the same name multiple times because of how the
239:             # db layout works.
240:             next if names.include?(pname.name)
241:             names << pname.name
242:             hash[:params] << pname.to_resourceparam(self, scope.source)
243:         end
244:         obj = Puppet::Parser::Resource.new(hash)
245: 
246:         # Store the ID, so we can check if we're re-collecting the same resource.
247:         obj.rails_id = self.id
248: 
249:         return obj
250:     end