nsarno / knock

Seamless JWT authentication for Rails API
MIT License
2.07k stars 253 forks source link

Fix NoMethodError when including Knock::Tokenizable #259

Closed muryoimpl closed 1 year ago

muryoimpl commented 4 years ago

I fixed NoMethodError when including Knock::Tokenizable. And I removed instance variable @object from Knock::Tokenizable, because I think that Knock expects Knock::Tokenizable to be included by descendent of ApplicationRecord and id method is in the descendent, not @object.

irb(main):006:0> include Knock::Tokenizable
Traceback (most recent call last):
        3: from (irb):6
        2: from (irb):6:in `rescue in irb_binding'
        1: from (irb):6:in `include'
NoMethodError (undefined method `extends' for Object:Class)
muryoimpl commented 4 years ago

Thank you for your reply. I' ll try to add a test for this.

muryoimpl commented 4 years ago

I've added include Knock::Tokenizable to Admin model, and added tests for it. If you have any concerns, please let me know.