lib/trestle/form/builder.rb in trestle-0.8.6 vs lib/trestle/form/builder.rb in trestle-0.8.7
- old
+ new
@@ -8,10 +8,14 @@
cattr_accessor :fields
self.fields = {}
def errors(name)
- object.errors[name].to_a
+ if object.respond_to?(:errors) && object.errors.respond_to?(:[])
+ object.errors[name].to_a
+ else
+ []
+ end
end
def self.register(name, klass)
rename_existing_helper_method(name)
self.fields[name] = klass