Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed bug. Made more robust. Still doesn't handle procs for condition…

…als.
  • Loading branch information...
commit 8622d0d0e68b2db2137e098b852b56e992412996 1 parent 615384e
Brian McNaboe authored

Showing 1 changed file with 2 additions and 1 deletion. Show diff stats Hide diff stats

  1. +2 1  lib/formtastic.rb
3  lib/formtastic.rb
@@ -449,7 +449,8 @@ def method_required?(attribute) #:nodoc:
449 449
450 450 @object.class.reflect_on_all_validations.any? do |validation|
451 451 cond_meth = validation.options[:if]
452   - validation.macro == :validates_presence_of && validation.name == attribute_sym && (@object.send(cond_meth) if cond_meth)
  452 + validation.macro == :validates_presence_of && validation.name == attribute_sym &&
  453 + (cond_meth && cond_meth.respond_to?(:to_sym) && @object.respond_to?(cond_meth) ? @object.send(cond_meth) : true)
453 454 end
454 455 else
455 456 @@all_fields_required_by_default

0 comments on commit 8622d0d

Please sign in to comment.
Something went wrong with that request. Please try again.