I am implementing a class hierarchy using the STI pattern
class A
scope :aaa, where([someField]:[someValue])
end
class B < A
end
The problem is that when I try to call something like:
B.limit(5).aaa
=> SELECT "[table]".* FROM "[table]" WHERE "[table]"."type" IN ('A') AND ([someField] = [someValue]) LIMIT 5
So, I get 5 objects of type A that satisfy the scope: aaa But I need to do the same with the strings, where type = "B"
Is there any way to use regions from the parent without redrawing it in children in the STI template?
Thanks in advance
EDITED
I just discussed this with my frind, and he showed me one important thing. A in non-root class STI. In fact, the whole hierarchy looks like
class O < ActiveRecord::Base
end
class A < O
scope ..... .....
end
class B < A
end
maybe the reason is in the hierarchy itself? ...
source
share