Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scopes defines on Her::Model::Relation instead of child class #407

Open
maximderbin opened this issue Jun 30, 2016 · 1 comment
Open

Scopes defines on Her::Model::Relation instead of child class #407

maximderbin opened this issue Jun 30, 2016 · 1 comment

Comments

@maximderbin
Copy link

maximderbin commented Jun 30, 2016

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]

seems the issue on this line https://github.com/remiprev/her/blob/master/lib/her/model/orm.rb#L110
scope defines on base class Her::Model::Relation instead of child scoped

@pboling
Copy link

pboling commented Jan 20, 2023

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

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

No branches or pull requests

2 participants