Skip to content

Commit

Permalink
also check for FieldName__c
Browse files Browse the repository at this point in the history
  • Loading branch information
twobitfool committed Jul 25, 2011
1 parent 093397a commit db62789
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/dm-salesforce-adapter/connection.rb
Expand Up @@ -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
Expand Down

0 comments on commit db62789

Please sign in to comment.