justinfrench/formtastic — pull request #1032 by justinfrench (2014-04-22 11:58:04+00:00)
Title: WIP Fix conditional validations for instance methods

This is an early work-in-progress branch (DON'T MERGE) which is related to #992. In #992 @willconsgrove was seeing an argument error when using conditional validations like this:

```ruby
unless: -> { whatever? }
```

Since 1e45bf1c, that error no longer occurs, but I believe we introduced a gap in our conditional logic, where a Proc with an arty of `0` (like in the case above) can slip through to the last `else` condition, rather than ever being called.

I'm trying to fix that here, and hoping @willcosgrove can get back to me ASAP.

I'm also curious (but not smart enough) to know if `object.instance_exec(&conditional)` could be used when the arity `> 0` (the first part of the conditional), allowing us to collapse the first and second together again. Maybe @aennchen can help out too?

Rough steps from here:

- [x] push up a basic fix
- [ ] get @willcosgrove to confirm it works for him
- [ ] get the specs cleaned up and properly fleshed out for all the branches in the conditional
- [ ] check with @aennchen if we can [collapse the first two conditionals](https://gist.github.com/justinfrench/11175929) and still satisfy this issue in #999
- [ ] merge on green
- [ ] merge into 2.3-stable as well