durran-validatable 1.8.0 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION.yml +1 -1
  2. data/lib/macros.rb +54 -0
  3. metadata +1 -1
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 8
3
- :patch: 0
3
+ :patch: 1
4
4
  :major: 1
@@ -217,6 +217,60 @@ module Validatable
217
217
  add_validations(args, ValidatesAssociated)
218
218
  end
219
219
 
220
+ # call-seq: validates_uniqueness_of(*args)
221
+ #
222
+ # Checks that the field is unique against existing documents in the database.
223
+ #
224
+ # class Person
225
+ # include Validatable
226
+ # attr_accessor :name
227
+ # validates_uniqueness_of :name
228
+ # end
229
+ #
230
+ # Configuration options:
231
+ #
232
+ # * message - The message to add to the errors collection when the validation fails
233
+ # * if - A block that when executed must return true of the validation will not occur
234
+ def validates_uniqueness_of(*args)
235
+ add_validations(args, ValidatesAssociated)
236
+ end
237
+
238
+ # call-seq: validates_inclusion_of(*args)
239
+ #
240
+ # Checks that the field is included in the supplied list.
241
+ #
242
+ # class Person
243
+ # include Validatable
244
+ # attr_accessor :name
245
+ # validates_inclusion_of :name, :within => ["value"]
246
+ # end
247
+ #
248
+ # Configuration options:
249
+ #
250
+ # * message - The message to add to the errors collection when the validation fails
251
+ # * if - A block that when executed must return true of the validation will not occur
252
+ def validates_inclusion_of(*args)
253
+ add_validations(args, ValidatesAssociated)
254
+ end
255
+
256
+ # call-seq: validates_exclusion_of(*args)
257
+ #
258
+ # Checks that the field is excluded from the supplied list.
259
+ #
260
+ # class Person
261
+ # include Validatable
262
+ # attr_accessor :name
263
+ # validates_exclusion_of :name, :within => ["value"]
264
+ # end
265
+ #
266
+ # Configuration options:
267
+ #
268
+ # * message - The message to add to the errors collection when the validation fails
269
+ # * if - A block that when executed must return true of the validation will not occur
270
+ def validates_exclusion_of(*args)
271
+ add_validations(args, ValidatesAssociated)
272
+ end
273
+
220
274
  # call-seq: include_validations_from(attribute)
221
275
  #
222
276
  # Includes all the validations that are defined on the attribute.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: durran-validatable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Fields