Closed ajselvig closed 9 years ago
This isn't a bug, really, but it would be nice to be able to specify an inline conditional for the required validation. Essentially, to be able to replace:
belongs_to :bar validates :bar, presence: true, if: -> {self.some_method}
with
belongs_to :bar, required: -> {self.some_method}
It's a minor difference, just thought I'd bring it up.
You can. If you pass options, they are passed to the validator:
belongs_to :bar, required: -> {if: :some_method}
:D
Gotcha, thanks. Maybe worth noting in the docs?
This isn't a bug, really, but it would be nice to be able to specify an inline conditional for the required validation. Essentially, to be able to replace:
with
It's a minor difference, just thought I'd bring it up.