Module: BravoModel::Utils

Included in:
Base
Defined in:
lib/bravo_model/utils.rb

Instance Method Summary collapse

Instance Method Details

#debugObject



5
6
7
8
# File 'lib/bravo_model/utils.rb', line 5

def debug
  raise "err" unless Rails.env.development?
  valid?; errors.full_messages
end

#full_errors(options = {}) ⇒ Object



11
12
13
14
15
16
# File 'lib/bravo_model/utils.rb', line 11

def full_errors(options={})
  arr = errors.full_messages
  arr.reject! { |x| x =~ options[:except] } if options.key?(:except)
  arr.select! { |x| x !~ options[:only] } if options.key?(:only)
  arr
end