Module: NinjaModel::Validation
- Included in:
- Base
- Defined in:
- lib/ninja_model/validation.rb
Instance Method Summary collapse
Instance Method Details
#save(options = {}) ⇒ Object
9 10 11 12 13 |
# File 'lib/ninja_model/validation.rb', line 9 def save(={}) run_callbacks :validation do valid?(.is_a?(Hash) ? [:context] : nil) ? super : false end end |
#valid?(context = nil) ⇒ Boolean
15 16 17 18 19 |
# File 'lib/ninja_model/validation.rb', line 15 def valid?(context = nil) context ||= (persisted? ? :update : :create) output = super(context) errors.empty? && output end |