Class: ValidationSets::ValidationSet
- Inherits:
-
Object
- Object
- ValidationSets::ValidationSet
show all
- Defined in:
- lib/validation_sets/validation_set.rb
Instance Method Summary
collapse
Constructor Details
#initialize(model, label) ⇒ ValidationSet
Returns a new instance of ValidationSet.
3
4
5
6
|
# File 'lib/validation_sets/validation_set.rb', line 3
def initialize(model, label)
@model = model
@label = label
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *attributes, &block) ⇒ Object
20
21
22
|
# File 'lib/validation_sets/validation_set.rb', line 20
def method_missing(method, *attributes, &block)
@model.send(method, *attributes, &block)
end
|
Instance Method Details
#validate(*params, &block) ⇒ Object
8
9
10
|
# File 'lib/validation_sets/validation_set.rb', line 8
def validate(*params, &block)
send(validation_set_method(:save, @label), *params, &block)
end
|
#validate_on_create(*params, &block) ⇒ Object
12
13
14
|
# File 'lib/validation_sets/validation_set.rb', line 12
def validate_on_create(*params, &block)
send(validation_set_method(:create, @label), *params, &block)
end
|
#validate_on_update(*params, &block) ⇒ Object
16
17
18
|
# File 'lib/validation_sets/validation_set.rb', line 16
def validate_on_update(*params, &block)
send(validation_set_method(:update, @label), *params, &block)
end
|