Skip to content
This repository was archived by the owner on Jun 5, 2020. It is now read-only.
This repository was archived by the owner on Jun 5, 2020. It is now read-only.

Possible discrepancy in the class to symbol casting #35

@pranav-g10

Description

@pranav-g10

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' 😕

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions