activesalesforce 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/asf_adapter.rb +10 -9
- data/lib/relationship_definition.rb +3 -3
- metadata +3 -3
data/lib/asf_adapter.rb
CHANGED
@@ -100,7 +100,7 @@ module ActiveRecord
|
|
100
100
|
class SalesforceAdapter < AbstractAdapter
|
101
101
|
|
102
102
|
class EntityDefinition
|
103
|
-
attr_reader :name, :columns, :column_name_to_column, :relationships
|
103
|
+
attr_reader :name, :columns, :column_name_to_column, :api_name_to_column, :relationships
|
104
104
|
|
105
105
|
def custom?
|
106
106
|
@custom
|
@@ -118,11 +118,12 @@ module ActiveRecord
|
|
118
118
|
|
119
119
|
@column_name_to_column = {}
|
120
120
|
@columns.each { |column| @column_name_to_column[column.name] = column }
|
121
|
+
|
122
|
+
@api_name_to_column = {}
|
123
|
+
@columns.each { |column| @api_name_to_column[column.api_name] = column }
|
121
124
|
end
|
122
125
|
end
|
123
126
|
|
124
|
-
COLUMN_VALUE_REGEX = /@V_'(([^']|\\')*)'/m
|
125
|
-
|
126
127
|
include StringHelper
|
127
128
|
|
128
129
|
attr_accessor :batch_size
|
@@ -234,12 +235,12 @@ module ActiveRecord
|
|
234
235
|
row = {}
|
235
236
|
|
236
237
|
record.each do |name, value|
|
237
|
-
name
|
238
|
-
if name != "type"
|
238
|
+
if name != :type
|
239
239
|
# Ids may be returned in an array with 2 duplicate entries...
|
240
|
-
value = value[0] if name ==
|
241
|
-
|
242
|
-
|
240
|
+
value = value[0] if name == :Id && value.is_a?(Array)
|
241
|
+
|
242
|
+
attribute_name = entity_def.api_name_to_column[name.to_s].name
|
243
|
+
row[attribute_name] = value
|
243
244
|
end
|
244
245
|
end
|
245
246
|
|
@@ -388,7 +389,7 @@ module ActiveRecord
|
|
388
389
|
column = SalesforceColumn.new(field)
|
389
390
|
cached_columns << column
|
390
391
|
|
391
|
-
cached_relationships << SalesforceRelationship.new(field) if field[:type] =~ /reference/i
|
392
|
+
cached_relationships << SalesforceRelationship.new(field, column) if field[:type] =~ /reference/i
|
392
393
|
end
|
393
394
|
|
394
395
|
if metadata.childRelationships
|
@@ -41,7 +41,7 @@ module ActiveRecord
|
|
41
41
|
|
42
42
|
attr_reader :name, :api_name, :custom, :foreign_key, :label, :reference_to, :one_to_many
|
43
43
|
|
44
|
-
def initialize(source)
|
44
|
+
def initialize(source, column = nil)
|
45
45
|
if source[:childSObject]
|
46
46
|
relationship = source
|
47
47
|
|
@@ -63,8 +63,8 @@ module ActiveRecord
|
|
63
63
|
@readonly = (field[:updateable] != "true" or field[:createable] != "true")
|
64
64
|
@reference_to = field[:referenceTo]
|
65
65
|
@one_to_many = false
|
66
|
-
|
67
|
-
@foreign_key =
|
66
|
+
|
67
|
+
@foreign_key = column.name
|
68
68
|
end
|
69
69
|
|
70
70
|
@name = column_nameize(@api_name)
|
metadata
CHANGED
@@ -3,9 +3,9 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: activesalesforce
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.2.
|
7
|
-
date: 2006-02-
|
8
|
-
summary: ActiveSalesforce is
|
6
|
+
version: 0.2.4
|
7
|
+
date: 2006-02-16 00:00:00 -05:00
|
8
|
+
summary: ActiveSalesforce (ASF) is a Rails connection adapter that provides direct access to Salesforce.com hosted data and metadata via the ActiveRecord model layer. Objects, fields, and relationships are all auto surfaced as active record attributes and rels.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email: dchasman@salesforce.com
|