activesalesforce 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +2 -3
- data/lib/salesforce_connection_adapter.rb +9 -8
- metadata +2 -2
data/README
CHANGED
@@ -18,14 +18,13 @@
|
|
18
18
|
|
19
19
|
4. edit database.yml
|
20
20
|
|
21
|
-
adapter:
|
22
|
-
url:
|
21
|
+
adapter: activesalesforce
|
22
|
+
url: https://www.salesforce.com/services/Soap/u/7.0
|
23
23
|
username: <salesforce user name goes here>
|
24
24
|
password: <salesforce password goes here>
|
25
25
|
|
26
26
|
5. proceed using standard Rails development techniques!
|
27
27
|
|
28
|
-
NOTE: To use a custom object append the word Custom to the name of the object instead of __c, e.g. FlipflapOnTheDuckmill would be FlipflapOnTheDuckmillCustom
|
29
28
|
|
30
29
|
== Description of contents
|
31
30
|
|
@@ -42,8 +42,8 @@ module ActiveRecord
|
|
42
42
|
@@cache = {}
|
43
43
|
|
44
44
|
# Establishes a connection to the database that's used by all Active Record objects.
|
45
|
-
def self.
|
46
|
-
puts "Using
|
45
|
+
def self.activesalesforce_connection(config) # :nodoc:
|
46
|
+
puts "Using ActiveSalesforce connection!"
|
47
47
|
|
48
48
|
url = config[:url]
|
49
49
|
username = config[:username]
|
@@ -121,7 +121,7 @@ module ActiveRecord
|
|
121
121
|
|
122
122
|
|
123
123
|
def adapter_name #:nodoc:
|
124
|
-
'
|
124
|
+
'ActiveSalesforce'
|
125
125
|
end
|
126
126
|
|
127
127
|
|
@@ -167,9 +167,9 @@ module ActiveRecord
|
|
167
167
|
log(sql, name)
|
168
168
|
|
169
169
|
# Check for SELECT COUNT(*) FROM query
|
170
|
-
|
171
|
-
if
|
172
|
-
|
170
|
+
selectCountMatch = sql.match(/SELECT COUNT\(\*\) FROM/i)
|
171
|
+
if selectCountMatch
|
172
|
+
soql = "SELECT id FROM#{selectCountMatch.post_match}"
|
173
173
|
end
|
174
174
|
|
175
175
|
raw_table_name = sql.match(/FROM (\w+)/i)[1]
|
@@ -179,7 +179,8 @@ module ActiveRecord
|
|
179
179
|
|
180
180
|
column_names = api_column_names(table_name)
|
181
181
|
|
182
|
-
|
182
|
+
# Always (unless COUNT*)'ing) select all columns (required for the AR attributes mechanism to work correctly
|
183
|
+
soql = sql.sub(/SELECT .+ FROM/i, "SELECT #{column_names.join(', ')} FROM") unless selectCountMatch
|
183
184
|
|
184
185
|
soql.sub!(/ FROM \w+/i, " FROM #{entity_def.api_name}")
|
185
186
|
|
@@ -231,7 +232,7 @@ module ActiveRecord
|
|
231
232
|
result << row
|
232
233
|
end
|
233
234
|
|
234
|
-
if
|
235
|
+
if selectCountMatch
|
235
236
|
[{ :count => result.actual_size }]
|
236
237
|
else
|
237
238
|
result
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: activesalesforce
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2006-02-
|
6
|
+
version: 0.2.0
|
7
|
+
date: 2006-02-06 00:00:00 -05:00
|
8
8
|
summary: ActiveSalesforce is an extension to the Rails Framework that allows for the dynamic creation and management of ActiveRecord objects through the use of Salesforce meta-data and uses a Salesforce.com organization as the backing store.
|
9
9
|
require_paths:
|
10
10
|
- lib
|