lib/civicrm/actions/create.rb in civicrm-1.3.4 vs lib/civicrm/actions/create.rb in civicrm-1.3.5
- old
+ new
@@ -4,14 +4,16 @@
module ClassMethods
def create(attrs = {})
params = {'entity' => entity_class_name, 'action' => 'create'}
response = CiviCrm::Client.request(:post, params.merge(attrs))
- if response.first.nil?
+ if response == 1
+ Resource.build_from(attrs, params)
+ elsif response.first.nil?
raise Error, "Couldn't create #{entity_class_name}"
+ else
+ Resource.build_from(response.first, params)
end
-
- Resource.build_from(response.first, params)
end
end
def self.included(base)
base.extend(ClassMethods)