Ruby on Rails Wednesday, August 16, 2017

Hi,
I can't seem to find anything on the web regarding this error I found. I don't know if it's something i did wrong or just some kind of bug.

I have 2 engines, named "Pes" and "Iss". "Pes" is the most atomic engine in our project and all other engines will add it as a dependency, it has these models:

Pes::Person
Pes::Person::Phone

The "Iss" engine depends on "Pes" and has these models that inherits from "Pes"

Iss::Person < Pes::Person
Iss::Person::Phone < Pes::Person::Phone

My problem is that, when I call Iss::Person.new, rails gives me an Iss::Person object... Great! But when I call Iss::Person::Phone, rails is giving me a Pes::Person::Phone object... I tried everything, and even when i remove the inheritance from the Iss::Person::Phone model, it still gives me the Pes::Person::Phone object.

Here's some sample code:

module Pes
  class Person < ApplicationRecord
     ...
  end
end

module Pes
  class Person::Phone < ApplicationRecord
     ...
  end
end

module Iss
  class Person < Pes::Person
     ...
  end
end
 
module Iss
  class Person::Phone < Pes::Person::Phone
     ...
  end
end

I'm using rails 4.2.9, but i tried to update to 5.0.2 and it still giving me this bug, I still haven't tried using rails >= 5.1

Also, sorry if my english doesn't make much sense, i'm from Brasil

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c28574ab-ac6e-438d-a757-f456db800e70%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment