validates_serialized icon indicating copy to clipboard operation
validates_serialized copied to clipboard

Allow the use of the :if argument to call local methods

Open DangerDawson opened this issue 9 years ago • 0 comments

Previous to this commit the following would fail silently:

validates_hash_keys :hash do
  validates :key, presence: true, if: :if_method
end

def if_method
  false
end

This PR allows us to call a locally scoped method only for the if: argument.

If you are happy with this PR we should probably add documentation

DangerDawson avatar Oct 14 '16 17:10 DangerDawson