Essentially when I do a lookup on any module I don't have access to, I get a response from the gem like:
/Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/associations/association.rb:81:in resolve_target': undefined methodklass' for false:FalseClass (NoMethodError)
from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/associations/association.rb:25:in initialize' from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/associations/associations.rb:9:innew'
from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/associations/associations.rb:9:in register' from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/associations/associations.rb:8:ineach_key'
from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/associations/associations.rb:8:in register' from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/associations/association_methods.rb:63:indefine_association_methods'
from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/base.rb:141:in initialize' from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/base.rb:34:innew'
from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/base.rb:34:in find' from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/finders/finder_methods.rb:182:infind_by_bug_number'
from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/finders/finder_methods.rb:187:in send' from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/finders/finder_methods.rb:187:inmethod_missing'
from ./update_blocklist.rb:151:in check_bug_closed' from ./update_blocklist.rb:114:incheck_blocklist'
from /Users/rsennewald/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/rexml/element.rb:891:in each' from /Users/rsennewald/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/rexml/xpath.rb:53:ineach'
from /Users/rsennewald/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/rexml/element.rb:891:in each' from ./update_blocklist.rb:107:incheck_blocklist'
from ./update_blocklist.rb:97:in each' from ./update_blocklist.rb:97:incheck_blocklist'
from ./update_blocklist.rb:66:in `Main'
from ./update_blocklist.rb:189
This can be confusing, and I realized that it was due to permissions issues after the same request worked just fine under a user with proper permissions. If possible, I think it would be best to catch the resolve_target issues and if it's permissions related indicate that in an output message.
I found this against 6.5.0 RC3, but I'd imagine it is reproducible on any recent version of Sugar. To reproduce: setup an instance and ensure a user account doesn't have permissions to the module / or rest requests. Then setup a connection on the gem and do a lookup like SugarCRM::Bug.first and you'll see the error I posted above.
Essentially when I do a lookup on any module I don't have access to, I get a response from the gem like:
/Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/associations/association.rb:81:in
resolve_target': undefined method
klass' for false:FalseClass (NoMethodError) from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/associations/association.rb:25:ininitialize' from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/associations/associations.rb:9:in
new' from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/associations/associations.rb:9:inregister' from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/associations/associations.rb:8:in
each_key' from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/associations/associations.rb:8:inregister' from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/associations/association_methods.rb:63:in
define_association_methods' from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/base.rb:141:ininitialize' from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/base.rb:34:in
new' from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/base.rb:34:infind' from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/finders/finder_methods.rb:182:in
find_by_bug_number' from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/finders/finder_methods.rb:187:insend' from /Users/rsennewald/.rvm/gems/ruby-1.8.7-p358/gems/sugarcrm-0.9.18/lib/sugarcrm/finders/finder_methods.rb:187:in
method_missing' from ./update_blocklist.rb:151:incheck_bug_closed' from ./update_blocklist.rb:114:in
check_blocklist' from /Users/rsennewald/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/rexml/element.rb:891:ineach' from /Users/rsennewald/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/rexml/xpath.rb:53:in
each' from /Users/rsennewald/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/rexml/element.rb:891:ineach' from ./update_blocklist.rb:107:in
check_blocklist' from ./update_blocklist.rb:97:ineach' from ./update_blocklist.rb:97:in
check_blocklist' from ./update_blocklist.rb:66:in `Main' from ./update_blocklist.rb:189This can be confusing, and I realized that it was due to permissions issues after the same request worked just fine under a user with proper permissions. If possible, I think it would be best to catch the resolve_target issues and if it's permissions related indicate that in an output message.
I found this against 6.5.0 RC3, but I'd imagine it is reproducible on any recent version of Sugar. To reproduce: setup an instance and ensure a user account doesn't have permissions to the module / or rest requests. Then setup a connection on the gem and do a lookup like SugarCRM::Bug.first and you'll see the error I posted above.