Module: Machinist::ActiveResourceExtensions::ClassMethods

Defined in:
lib/machinist_activeresource.rb

Instance Method Summary collapse

Instance Method Details

#make(*args, &block) ⇒ Object



47
48
49
50
51
52
53
54
55
# File 'lib/machinist_activeresource.rb', line 47

def make(*args, &block)
  lathe = Lathe.run(Machinist::ActiveResourceAdapter, self.new, *args)
  # What is Nerfed ?
  #unless Machinist.nerfed?
    #lathe.object.save!
    #lathe.object.reload
  #end
  lathe.object(&block)
end

#make_unsaved(*args) {|object| ... } ⇒ Object

Yields:

  • (object)


57
58
59
60
61
# File 'lib/machinist_activeresource.rb', line 57

def make_unsaved(*args)
  object = Machinist.with_save_nerfed { make(*args) }
  yield object if block_given?
  object
end

#plan(*args) ⇒ Object



63
64
65
66
# File 'lib/machinist_activeresource.rb', line 63

def plan(*args)
  lathe = Lathe.run(Machinist::ActiveResourceAdapter, self.new, *args)
  Machinist::ActiveResourceAdapter.assigned_attributes_without_associations(lathe)
end