Class: Metrojobb::Model

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
lib/metrojobb/model.rb

Direct Known Subclasses

Ad, Category, Contact, EmploymentType, Location, Region

Constant Summary collapse

InvalidError =
Class.new(StandardError)

Instance Method Summary collapse

Instance Method Details

#to_xml!Object

Raises:



9
10
11
12
13
14
# File 'lib/metrojobb/model.rb', line 9

def to_xml!
  return to_xml if valid?

  error_message = "#{model_name} has errors on: #{self.errors.keys.join(', ')}"
  raise(InvalidError, error_message)
end