That is pretty strange-- but it looks like you’re doing something
non-standard and you’ve gotten yourself into a pickle.
I notice that the error message says there’s no method ‘where’ on an
instance of an Article. Normally you call where on the class itself.
First of all, why is your class named “X” in your example (did you do
that just to share you code? It’s a little confusing)?
Secondly, can you show us the calling code please?
Finally, put a debugging statement inside of self.low_level and then
type “self” to understand the context (scope) of how it is called – if
“self” inside the method is actually your Article class or (somehow) an
instance of an Article.
That is pretty strange-- but it looks like you’re doing something
non-standard and you’ve gotten yourself into a pickle.
I notice that the error message says there’s no method ‘where’ on an
instance of an Article. Normally you call where on the class itself.
Good point
First of all, why is your class named “X” in your example (did you do
that just to share you code? It’s a little confusing)?
I did that just to share code
Secondly, can you show us the calling code please?
Finally, put a debugging statement inside of self.low_level and then
type “self” to understand the context (scope) of how it is called – if
“self” inside the method is actually your Article class or (somehow) an
instance of an Article.
There isn’t enough code here to know for sure, but something strange is
going on with your X class. Line 9 of active_record/querying.rb
delegates
the where method to all. Normally this is a class method that
returns a
Relation object. Does your X class have an all class method that’s
overriding that?
–Matt J.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.