Module: ConfigureMe::Validations

Extended by:
ActiveSupport::Concern
Included in:
Base
Defined in:
lib/configure_me/validations.rb

Instance Method Summary collapse

Instance Method Details

#save(options = {}) ⇒ Object



12
13
14
15
16
# File 'lib/configure_me/validations.rb', line 12

def save(options={})
  run_callbacks :validation do
    perform_validations(options) ? super : false
  end
end

#valid?(context = nil) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
21
22
# File 'lib/configure_me/validations.rb', line 18

def valid?(context = nil)
  context ||= (persisted? ? :update : :create)
  output = super(context)
  errors.empty? && output
end