Module: Validateable
Defined Under Namespace
Modules: ClassMethods
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(symbol, *_params) ⇒ Object
5
6
7
|
# File 'lib/validateable.rb', line 5
def method_missing(symbol, *_params)
send($1) if symbol.to_s =~ /(.*)_before_type_cast$/
end
|
Class Method Details
.append_features(base) ⇒ Object
9
10
11
12
13
|
# File 'lib/validateable.rb', line 9
def self.append_features(base)
super
base.send(:include, ActiveModel::Validations)
base.extend ClassMethods
end
|
Instance Method Details
#validate! ⇒ Object
15
16
17
|
# File 'lib/validateable.rb', line 15
def validate!
raise(ActiveRecord::RecordInvalid, self) unless valid?
end
|