[Nitro] How best to submit patches
Tim Larson
tim at keow.org
Fri Sep 23 09:05:27 EDT 2005
On Fri, Sep 23, 2005 at 01:59:19PM +0100, Tim Larson wrote:
> I also wrote such a fill function and did not get a chance
> to send it in yet...would you mind sending the patches to
> the list so we can all seem them, without the week delay
> waiting for a formal release? :)
For balance, here is my fill method. I just converted it
from a method in the form.rb mixin that generates forms,
and it only handles the passed object, not any relations.
def fill(obj, options = {})
for p in obj.class.properties
next if :oid == p.symbol unless options[:all]
ancestors = p.klass.ancestors
if ancestors.include?(Numeric)
unless p.meta[:relation]
obj.send("__force_#{p.symbol}", request["#{p.symbol}"])
end
elsif ancestors.include?(String)
obj.send("__force_#{p.symbol}", request["#{p.symbol}"])
elsif ancestors.include?(TrueClass)
puts '==== TrueClass ===='
puts request["#{p.symbol}"]
puts '========'
obj.send("#{p.symbol}=", request["#{p.symbol}"] ? true : false)
elsif ancestors.include?(Time)
obj.send("__force_#{p.symbol}", request["#{p.symbol}"])
end
end
end
--Tim Larson
More information about the Nitro-general
mailing list