# Raise an error when predicate is used outside a macro

**URL:** https://discourse.dry-rb.org/t/raise-an-error-when-predicate-is-used-outside-a-macro/308
**Category:** dry-validation
**Created:** [July 8, 2017, 5:10pm UTC](https://discourse.dry-rb.org/t/raise-an-error-when-predicate-is-used-outside-a-macro/308 "2017-07-08T17:10:30Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![radanskoric](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/radanskoric/32/116_2.png) [@radanskoric](https://discourse.dry-rb.org/u/radanskoric)
#### Post date: [July 8, 2017, 5:10pm UTC](https://discourse.dry-rb.org/t/raise-an-error-when-predicate-is-used-outside-a-macro/308/1 "2017-07-08T17:10:30Z")

</div>

If you write a rule in the following way:

```auto
Dry::Validation.Schema do
  required(:email).filled?
end

```

No exception will be raised because `filled?` will be accepted by `method_missing` as a valid `predicate`. Instead it will silently generate an empty rule without any validation.

This got me. I was a bit tired and I spent about 15 min trying to figure out what is wrong. I simply didn’t notice that I have a typo since I was expecting that a typo would give me an undefined method error.

I think that in such a case the gem should notice that the function call will have no effect and print a warning.

If you agree that it makes sense, I’d like to create the PR myself since I’d like to get a bit more familiar with the inner workings of dry validation.
