Module: ActiveGroonga::Validations
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveModel::Validations
- Included in:
- Base
- Defined in:
- lib/active_groonga/validations.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#save(options = {}) ⇒ Object
52 53 54 |
# File 'lib/active_groonga/validations.rb', line 52 def save(={}) validate() ? super : false end |
#save!(options = {}) ⇒ Object
56 57 58 |
# File 'lib/active_groonga/validations.rb', line 56 def save!(={}) validate() ? super : raise(RecordInvalid.new(self)) end |
#valid?(context = nil) ⇒ Boolean
60 61 62 63 64 |
# File 'lib/active_groonga/validations.rb', line 60 def valid?(context=nil) context ||= (new_record? ? :create : :update) valid = super(context) errors.empty? and valid end |