Module: Toy::Validations
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveModel::Validations
- Included in:
- Store
- Defined in:
- lib/toy/validations.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#save(options = {}) ⇒ Object
21 22 23 |
# File 'lib/toy/validations.rb', line 21 def save(={}) !.fetch(:validate, true) || valid? ? super : false end |
#save! ⇒ Object
25 26 27 |
# File 'lib/toy/validations.rb', line 25 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 |