Module: Toy::Validations
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/toy/validations.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#save(options = {}) ⇒ Object
21 22 23 24 |
# File 'lib/toy/validations.rb', line 21 def save(={}) .assert_valid_keys(:validate) !.fetch(:validate, true) || valid? ? super : false end |
#save! ⇒ Object
26 27 28 |
# File 'lib/toy/validations.rb', line 26 def save! save || raise(RecordInvalid.new(self)) end |
#valid? ⇒ Boolean
17 18 19 |
# File 'lib/toy/validations.rb', line 17 def valid? run_callbacks(:validation) { super } end |