Reply
Visitor
jbasdf
Posts: 2

Error using ActiveSalesForce - The :dependent option expects either :destroy or :delete (:nullify)

[ Edited ]
I am currently running Rails 2.1 and have run into a problem.  The first time I try to run a command such as find against Salesforce I get this error (the second query works fine):

"The :dependent option expects either :destroy or :delete (:nullify)"

The stack trace looks like this:
/Library/Ruby/Gems/1.8/gems/activerecord-2.1.0/lib/active_record/associations.rb:1332:in `configure_dependency_for_belongs_to'
/Library/Ruby/Gems/1.8/gems/activerecord-2.1.0/lib/active_record/associations.rb:940:in `belongs_to'
/Library/Ruby/Gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:705:in `configure_active_record'
/Library/Ruby/Gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:672:in `each'
/Library/Ruby/Gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:672:in `configure_active_record'
/Library/Ruby/Gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:649:in `get_entity_def'
/Library/Ruby/Gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:764:in `lookup'
/Library/Ruby/Gems/1.8/gems/activerecord-activesalesforce-adapter-2.0.0/lib/active_record/connection_adapters/activesalesforce_adapter.rb:268:in `select_all'


I have tracked the error to line 705 in activesalesforce_adapter.rb:

klass.belongs_to referenceName.to_sym, :class_name => referenced_klass.name, :foreign_key => foreign_key, :dependent => :nullify

If I remove ':dependent => :nullify' then everything works fine.


For reference this is my model:

class Contact < ActiveRecord::Base
    establish_connection :salesforce_production
end

:salesforce_production refers to my connection parameters in database.yml.

and here is the call I am making:
sf_user = Contact.find(:first,:conditions => {:email => self.email} ) || Contact.new()

Is this a bug or have I misconfigured something?

Thanks,
Justin



Message Edited by jbasdf on 07-02-2008 05:10 PM
Visitor
jbasdf
Posts: 2

Re:Error using ActiveSalesForce The :dependent option expects either :destroy or :delete (:nullify)

I found this post on Ruby Forge that indicates that there is a bug:
http://rubyforge.org/tracker/index.php?func=detail&aid=19960&group_id=1201&atid=4729

There is a patch attached so for now I can just unpack the gem.  Is there anytime frame for this to be fixed?  Is this project still in active development?