chicks / sugarcrm

A ruby based REST Client for SugarCRM
MIT License
90 stars 64 forks source link

NoMethodError: undefined method `klass' for false:FalseClass #91

Open tjsousa opened 11 years ago

tjsousa commented 11 years ago

Got this error when trying to retrieve Contacts from a SugarCRM installation. I'm pretty clueless about this because it seems to work in every other installation I've tried before.

Pretty standard SugarCRM::Contact.all after SugarCRM.connect(...)

NoMethodError: undefined method `klass' for false:FalseClass
        from /Users/tiago/.rvm/gems/ruby-1.9.3-p194/gems/sugarcrm-0.9.18/lib/sugarcrm/associations/association.rb:81:in `resolve_target'
        from /Users/tiago/.rvm/gems/ruby-1.9.3-p194/gems/sugarcrm-0.9.18/lib/sugarcrm/associations/association.rb:25:in `initialize'
        from /Users/tiago/.rvm/gems/ruby-1.9.3-p194/gems/sugarcrm-0.9.18/lib/sugarcrm/associations/associations.rb:9:in `new'
        from /Users/tiago/.rvm/gems/ruby-1.9.3-p194/gems/sugarcrm-0.9.18/lib/sugarcrm/associations/associations.rb:9:in `block in register'
        from /Users/tiago/.rvm/gems/ruby-1.9.3-p194/gems/sugarcrm-0.9.18/lib/sugarcrm/associations/associations.rb:8:in `each_key'
        from /Users/tiago/.rvm/gems/ruby-1.9.3-p194/gems/sugarcrm-0.9.18/lib/sugarcrm/associations/associations.rb:8:in `register'
        from /Users/tiago/.rvm/gems/ruby-1.9.3-p194/gems/sugarcrm-0.9.18/lib/sugarcrm/associations/association_methods.rb:63:in `define_association_methods'
        from /Users/tiago/.rvm/gems/ruby-1.9.3-p194/gems/sugarcrm-0.9.18/lib/sugarcrm/base.rb:141:in `initialize'
        from /Users/tiago/.rvm/gems/ruby-1.9.3-p194/gems/sugarcrm-0.9.18/lib/sugarcrm/base.rb:34:in `new'
        from /Users/tiago/.rvm/gems/ruby-1.9.3-p194/gems/sugarcrm-0.9.18/lib/sugarcrm/base.rb:34:in `find'
        from /Users/tiago/.rvm/gems/ruby-1.9.3-p194/gems/sugarcrm-0.9.18/lib/sugarcrm/base.rb:96:in `all'
        from (irb):26
        from /Users/tiago/.rvm/gems/ruby-1.9.3-p194/gems/padrino-core-0.10.7/lib/padrino-core/cli/base.rb:68:in `console'
        from /Users/tiago/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.15.4/lib/thor/task.rb:27:in `run'
        from /Users/tiago/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.15.4/lib/thor/invocation.rb:120:in `invoke_task'
        from /Users/tiago/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.15.4/lib/thor.rb:275:in `dispatch'
        from /Users/tiago/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.15.4/lib/thor/invocation.rb:109:in `invoke'
        from /Users/tiago/.rvm/gems/ruby-1.9.3-p194/gems/padrino-core-0.10.7/lib/padrino-core/cli/base.rb:73:in `c
chicks commented 11 years ago

Hrm... looks like it's choking on resolving an association to the Contacts module. Check that the relationships to Contacts are all okay in Sugar studio.

tjsousa commented 11 years ago

Unfortunately I have no control of the SugarCRM installation where this is happening as I develop a piece of software that must work with third-party SugarCRM accounts.

But I was able to avoid this error but checking on the module_name result value. Hope this helps :)

chicks commented 11 years ago

Even better! Thanks again!

captivea-ylb commented 10 years ago

I have the same problem for this line userAssignedSugar = SugarCRM::User.find_by_first_name_and_last_name(userAssigned.firstname.capitalize, userAssigned.lastname.upcase)

I don't understand how tjsousa resolve this issue. You can help me ?

captivea-ylb commented 10 years ago

I have that too for Account.

sudeepsnairontash commented 10 years ago

When I try to access Accounts module, it shows an error "undefined method `klass' for false:FalseCla ss (NoMethodError)" somebody plz help me. Thanks in advance