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
Hi everyone. Today I run into the problem that I have scope defined in one model appears in other model. See my code example:
[1] pry(main)> class Model
[1] pry(main)* include Her::Model
[1] pry(main)* end
=> Model
[2] pry(main)> class Model2 < Model
[2] pry(main)* scope :test_me, -> { where(page: 1) }
[2] pry(main)* end
=> :test_me
[3] pry(main)> class Model3 < Model
[3] pry(main)* end
=> nil
[4] pry(main)> Model3.all.respond_to?(:test_me)
=> true
[7] pry(main)> Her::Model::Relation.instance_methods.grep(/test_me/)
=> [:test_me]
WARNING This gem appears dead, since at least 2016, and this bug report.
If you have a test suite and use scope macros from her, and use inheritance in your models, your test suite will not be able to load due to scope being defined on the wrong class. Consider migrating to https://github.com/balvig/spyke
Hi everyone. Today I run into the problem that I have scope defined in one model appears in other model. See my code example:
seems the issue on this line https://github.com/remiprev/her/blob/master/lib/her/model/orm.rb#L110
scope
defines on base classHer::Model::Relation
instead of child scopedThe text was updated successfully, but these errors were encountered: