hello, i'm trying to use og managed models under ruby modules. consider this:
module Common class User property :name, String has_many :posts, Blog::Post, :foreign_field => 'owner_oid' end end module Blog class Post property :title, String property :content, String belongs_to :owner, Common::User end end
the tables ogblogpost and ogcommonuser are created, but og cannot resolve the relations between them because it cannot find the Blog module when resolving the has_many relation in Common::User.
this example is not my real app, but it shows exactly what my problem looks like. am i doing something wrong or is it a limitation of og?
(1 attempts)
Kashia answered:
Ruby has problems resolving the Module Blog in this case, since it hasn't seen it yet.
A workaround is to use forward declarations:
module Blog; class Post; end; end
Adding this before module Common will make your program work correctly.