Sha256: ed3de96cc9773d11c17a04a293b92ca10da48d7e30893302a7579d5a004be990
Contents?: true
Size: 774 Bytes
Versions: 4
Compression:
Stored size: 774 Bytes
Contents
module ActiveConformityCustomMethods end =begin This file is for creating custom methods that you can add to the conformity set of a conformable. The object that these methods will run against is availible by calling 'obj'. Additionally, you can utilize any of the named arguments that were saved in the conformity set. For example: For a conformable with the conformity_set like: { method: { name: 'content_is?', arguments: {string: 'hello world' } } } You can define the following method in this module: def content_is? if obj.content == method_args[:string] return true else errors.add(:content, "does not match #{method_args[:string]}") end end Be sure to follow the rails convention of adding errors in the false case! =end
Version data entries
4 entries across 4 versions & 1 rubygems