Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

No longer assumes the form's object responds to :errors. Sometimes we…

… don't use ActiveRecord models as form objects.
  • Loading branch information...
commit b700aca0fed8ad8b7167a0e029b0d389424081d8 1 parent 02a2c2e
@airblade authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  lib/air_blade/air_budd/form_builder.rb
View
3  lib/air_blade/air_budd/form_builder.rb
@@ -299,6 +299,7 @@ def button(purpose = :save, options = {}, html_options = {})
end
def method_missing(*args, &block)
+ # Button method
if args.first.to_s =~ /^(new|save|cancel|edit|delete)$/
button args.shift, *args, &block
else
@@ -373,7 +374,7 @@ def addendum_element(options = {})
end
def errors_for?(method)
- @object && @object.errors[method]
+ @object && @object.respond_to?(:errors) && @object.errors[method]
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.