Guest User

Untitled

a guest
May 13th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. ENV['BUNDLE_GEMFILE'] = "Gemfile"
  2. Bundler.setup
  3. require "dm-salesforce"
  4.  
  5. DataMapper.setup(:salesforce, {:adapter => 'salesforce',
  6. :username => 'username',
  7. :password => 'password',
  8. :path => File.join("config", 'salesforce.wsdl'),
  9. :apidir => "tmp/dm-salesforce"
  10. })
  11.  
  12. class Contact
  13. include DataMapper::Salesforce::Resource
  14.  
  15. def self.default_repository_name
  16. :salesforce
  17. end
  18.  
  19. property :id, Serial
  20. property :firstname, String, :field => "FirstName"
  21. property :lastname, String, :field => "LastName"
  22. property :home_phone, String, :field => "HomePhone"
  23.  
  24. #property :account_id, Serial, :field => "AccountId"
  25.  
  26. #belongs_to :account, :model => "Salesforce::Account"
  27. #belongs_to :master_contact, :model => "Salesforce::Contact"
  28. end
  29.  
  30. Contact.all # => All my contacts - works well
  31. Contact.last.id # => "0032000000c8UUAAA2"
  32. Contact.get("0032000000bW9zAAAS") # => NameError: uninitialized constant DataMapper::Salesforce::Property
Add Comment
Please, Sign In to add comment