Module: Panda::Builders::ClassMethods

Included in:
Proxy
Defined in:
lib/panda/modules/builders.rb

Instance Method Summary collapse

Instance Method Details

#create(attributes = {}) {|resource| ... } ⇒ Object

Yields:

  • (resource)


10
11
12
13
14
15
16
# File 'lib/panda/modules/builders.rb', line 10

def create(attributes={})
 resource = build_resource(attributes)
 yield resource if block_given?

 resource.create
 resource
end

#create!(attributes = {}) {|resource| ... } ⇒ Object

Yields:

  • (resource)


18
19
20
21
22
23
24
# File 'lib/panda/modules/builders.rb', line 18

def create!(attributes={})
  resource = build_resource(attributes)
  yield resource if block_given?

  resource.create!
  resource
end