Class: Machinist::ActiveRecord::Blueprint

Inherits:
Blueprint
  • Object
show all
Defined in:
lib/machinist/active_record/blueprint.rb

Instance Attribute Summary

Attributes inherited from Blueprint

#block, #klass, #parent

Instance Method Summary collapse

Methods inherited from Blueprint

#each_ancestor, #initialize, #make, #parent_blueprint

Constructor Details

This class inherits a constructor from Machinist::Blueprint

Instance Method Details

#lathe_classObject

:nodoc:



14
15
16
# File 'lib/machinist/active_record/blueprint.rb', line 14

def lathe_class #:nodoc:
  Machinist::ActiveRecord::Lathe
end

#make!(attributes = {}) ⇒ Object

Make and save an object.



5
6
7
8
9
10
11
12
# File 'lib/machinist/active_record/blueprint.rb', line 5

def make!(attributes = {})
  object = make(attributes)
  object.save!
  object.reload
rescue ::ActiveRecord::RecordInvalid => exception
  message = "#{exception.class.name}: \"#{exception.message}\" saving #{exception.record.class.name}"
  raise Machinist::BlueprintCantSaveError.new(self, message)
end