Module: Ricordami::CanBeValidated::InstanceMethods

Defined in:
lib/ricordami/can_be_validated.rb

Instance Method Summary collapse

Instance Method Details

#save(opts = {}) ⇒ Object



21
22
23
24
# File 'lib/ricordami/can_be_validated.rb', line 21

def save(opts = {})
  return false unless opts[:validate] == false || valid?
  super(opts)
end

#valid?Boolean

Returns:

  • (Boolean)

Raises:



16
17
18
19
# File 'lib/ricordami/can_be_validated.rb', line 16

def valid?
  raise ModelHasBeenDeleted.new("can't validate a deleted model") if deleted?
  super
end