If you place ASF models in their own module, for example Salesforce::Account, Salesforce::Contact, etc, interesting
things can occur:
>> Salesforce::Account.find('00100000003ShySAAS').contacts.size
ActiveSalesforce::ASFError: INVALID_FIELD: No such column 'account_id' on entity 'Contact'. If you are attempting to
use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe
call for the appropriate names.
from /var/lib/gems/1.8/gems/activesalesforce-1.1.6/lib/asf_adapter.rb:579:in `get_result'
from /var/lib/gems/1.8/gems/activesalesforce-1.1.6/lib/asf_adapter.rb:294:in `select_all'
from /var/lib/gems/1.8/gems/activesalesforce-1.1.6/lib/asf_adapter.rb:372:in `select_one'
from /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/database_statemen
ts.rb:19:in `select_value'
from /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:212:in
`execute_simple_calculation'
from /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:121:in `calculate'
from /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:117:in `catch'
from /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:117:in `calculate'
from /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/calculations.rb:45:in `count'
from /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/associations/has_many_association.rb:141:in
`count_records'
from /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/associations/association_collection.rb:107:in
`size'
from (irb):59
from :0
Strangely enough, just calling contacts (basically, Contact.find_all_by_account_id id) works, but
ActiveSalesforce::ResultArray#size breaks! |