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

Possible discrepancy in the class to symbol casting #35

Open
pranav-g10 opened this issue Apr 26, 2014 · 0 comments
Open

Possible discrepancy in the class to symbol casting #35

pranav-g10 opened this issue Apr 26, 2014 · 0 comments

Comments

@pranav-g10
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant