sugarcrm icon indicating copy to clipboard operation
sugarcrm copied to clipboard

NoMethodError: undefined method `klass' for false:FalseClass

Open tjsousa opened this issue 12 years ago • 6 comments

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

tjsousa avatar Apr 20 '13 01:04 tjsousa

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.

chicks avatar Apr 20 '13 02:04 chicks

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 :)

tjsousa avatar Apr 22 '13 12:04 tjsousa

Even better! Thanks again!

chicks avatar Apr 22 '13 13:04 chicks

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 avatar Jul 15 '14 11:07 captivea-ylb

I have that too for Account.

captivea-ylb avatar Jul 15 '14 13:07 captivea-ylb

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

sudeepsnairontash avatar Oct 27 '14 05:10 sudeepsnairontash