You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a party has a note with attachments, then running CapsuleCRM::Organization.find(<id>).histories generates the following error:
NoMethodError: Expected [{"id"=>"31511119", "filename"=>"005_550.jpg", "contentType"=>"image/jpeg"}, {"id"=>"31511120", "filename"=>"Airvan1.jpg", "contentType"=>"image/jpeg"}, {"id"=>"31511121", "filename"=>"airsafaris-2nomads-5.jpg", "contentType"=>"image/jpeg"}, {"id"=>"31511122", "filename"=>"L.Tekapo_-_Cass_River.jpg", "contentType"=>"image/jpeg"}, {"id"=>"31511123", "filename"=>"N24_at_QN.JPG", "contentType"=>"image/jpeg"}, {"id"=>"31511124", "filename"=>"Logo_snowed.jpg", "contentType"=>"image/jpeg"}] to respond to #to_hash
from .../vendor/bundle/ruby/2.2.0/gems/virtus-1.0.5/lib/virtus/attribute_set.rb:196:in `coerce'
from .../vendor/bundle/ruby/2.2.0/gems/virtus-1.0.5/lib/virtus/attribute_set.rb:170:in `set'
from .../vendor/bundle/ruby/2.2.0/gems/virtus-1.0.5/lib/virtus/instance_methods.rb:17:in `initialize'
from .../vendor/bundle/ruby/2.2.0/gems/capsule_crm-1.10.3/lib/capsule_crm/associations/has_many_association.rb:83:in `new'
from .../vendor/bundle/ruby/2.2.0/gems/capsule_crm-1.10.3/lib/capsule_crm/associations/has_many_association.rb:83:in `collection_to_array'
from .../vendor/bundle/ruby/2.2.0/gems/capsule_crm-1.10.3/lib/capsule_crm/associations/has_many_association.rb:78:in `build_target'
from .../vendor/bundle/ruby/2.2.0/gems/capsule_crm-1.10.3/lib/capsule_crm/associations/has_many_association.rb:42:in `proxy'
from .../vendor/bundle/ruby/2.2.0/gems/capsule_crm-1.10.3/lib/capsule_crm/associations/has_many.rb:62:in `block in has_many'
from .../vendor/bundle/ruby/2.2.0/gems/virtus-1.0.5/lib/virtus/attribute_set.rb:173:in `block in set'
from .../vendor/bundle/ruby/2.2.0/gems/virtus-1.0.5/lib/virtus/attribute_set.rb:170:in `each'
from .../vendor/bundle/ruby/2.2.0/gems/virtus-1.0.5/lib/virtus/attribute_set.rb:170:in `set'
from .../vendor/bundle/ruby/2.2.0/gems/virtus-1.0.5/lib/virtus/instance_methods.rb:17:in `initialize'
from .../vendor/bundle/ruby/2.2.0/gems/capsule_crm-1.10.3/lib/capsule_crm/normalizer.rb:72:in `new'
from .../vendor/bundle/ruby/2.2.0/gems/capsule_crm-1.10.3/lib/capsule_crm/normalizer.rb:72:in `block in normalize_standard_collection'
from .../vendor/bundle/ruby/2.2.0/gems/capsule_crm-1.10.3/lib/capsule_crm/normalizer.rb:68:in `map'
from .../vendor/bundle/ruby/2.2.0/gems/capsule_crm-1.10.3/lib/capsule_crm/normalizer.rb:68:in `normalize_standard_collection'
from .../vendor/bundle/ruby/2.2.0/gems/capsule_crm-1.10.3/lib/capsule_crm/normalizer.rb:18:in `normalize_collection'
from .../vendor/bundle/ruby/2.2.0/gems/capsule_crm-1.10.3/lib/capsule_crm/associations/belongs_to_finder.rb:34:in `find_by_parent_id'
from .../vendor/bundle/ruby/2.2.0/gems/capsule_crm-1.10.3/lib/capsule_crm/associations/belongs_to_finder.rb:12:in `call'
from .../vendor/bundle/ruby/2.2.0/gems/capsule_crm-1.10.3/lib/capsule_crm/associations/belongs_to.rb:46:in `block (2 levels) in belongs_to'
from .../vendor/bundle/ruby/2.2.0/gems/capsule_crm-1.10.3/lib/capsule_crm/associations/has_many_association.rb:93:in `target'
from .../vendor/bundle/ruby/2.2.0/gems/capsule_crm-1.10.3/lib/capsule_crm/associations/has_many_association.rb:78:in `build_target'
from .../vendor/bundle/ruby/2.2.0/gems/capsule_crm-1.10.3/lib/capsule_crm/associations/has_many_association.rb:42:in `proxy'
from .../vendor/bundle/ruby/2.2.0/gems/capsule_crm-1.10.3/lib/capsule_crm/associations/has_many.rb:57:in `block in has_many'
To recreate, set up an organization, then in CapsuleCRM create a note with file attachments.
The text was updated successfully, but these errors were encountered:
Is this still an issue? I'm trying to replicate in a test app but it seems to be working fine. I'm adding 2 notes each with an attachment to an organisation in the capsule UI and then fetching them with the gem.
I think it only happens with > 1 attachment. It is still an issue, of sorts. I solved it with this mixin:
moduleVirtusclassAttributeSetdefcoerce(attributes)ifattributes.is_a?Arraykeys={}self.each_with_index{|item,index| keys[index.to_s]=item.to_hashifitem.respond_to?:to_hash}keyselse
::Hash.try_convert(attributes)orraise(NoMethodError,"Expected #{attributes.inspect} to respond to #to_hash")endendendend
... but it would be good to solve the root issue too.
If a party has a note with attachments, then running
CapsuleCRM::Organization.find(<id>).histories
generates the following error:To recreate, set up an organization, then in CapsuleCRM create a note with file attachments.
The text was updated successfully, but these errors were encountered: