streama icon indicating copy to clipboard operation
streama copied to clipboard

Possible discrepancy in the class to symbol casting

Open pranav-g10 opened this issue 10 years ago • 0 comments

When an activity is defined, it is allowed to specify the actor/object classes as symbols. Even the example in the readme is

activity :new_photo do
    actor :user, :cache => [:full_name]
    object :photo, :cache => [:subject, :comment]
    target_object :album, :cache => [:title]
  end

Note, that the symbols (user/photo/album) are all lower-case. But in the assign_data method of class Activity the error check goes as:

class_sym = object.class.name.underscore.to_sym
raise Errors::InvalidData.new(class_sym) unless definition.send(type).has_key?(class_sym)

So if I send an object of the class User, class_sym would be :User and not :user which should cause the check to fail and the error to be raised.

PS I haven't seen any such error till now (not till I started tinkering with the source in my fork), which is why I mentioned 'possbile discrepancy' :confused:

pranav-g10 avatar Apr 26 '14 13:04 pranav-g10