Permalink
Browse files

also check for FieldName__c

  • Loading branch information...
1 parent 7943a48 commit cda2b4f7259318e000b03339f04cc3b5906b11e6 @twobitfool twobitfool committed with jpr5 Jul 25, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/dm-salesforce-adapter/connection.rb
View
4 lib/dm-salesforce-adapter/connection.rb
@@ -49,14 +49,14 @@ def make_object(klass_name, values)
def field_name_for(klass_name, column)
klass = SalesforceAPI.const_get(klass_name)
- fields = [column, Inflector.camelize(column.to_s), "#{column}__c".downcase]
+ fields = [column, Inflector.camelize(column.to_s), "#{Inflector.camelize(column.to_s)}__c", "#{column}__c".downcase]
options = /^(#{fields.join("|")})$/i
matches = klass.instance_methods(false).grep(options)
if matches.any?
matches.first
else
raise FieldNotFound,
- "You specified #{column} as a field, but neither #{fields.join(" or ")} exist. " \
+ "You specified #{column} as a field, but none of the expected field names exist: #{fields.join(", ")}. " \
"Either manually specify the field name with :field, or check to make sure you have " \
"provided a correct field name."
end

0 comments on commit cda2b4f

Please sign in to comment.