Ruby on Rails
Thursday, August 17, 2017
I think you could solve your problem by explicitly writing all modules and moving the file in the appropriate foder, this should solve your autoloading issues.
-- For example for Pes::Person::Phone you should do this:
module Pes
module Person
class Phone
end
end
end
and you need to put this file into pes/person/phone.rb
Il giorno mercoledì 16 agosto 2017 19:21:58 UTC+2, Daniel Faiole ha scritto:
Il giorno mercoledì 16 agosto 2017 19:21:58 UTC+2, Daniel Faiole ha scritto:
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
endmodule Pes
class Person::Phone < ApplicationRecord...end
endmodule Iss
class Person < Pes::Person...end
endmodule 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/d01e323d-bdef-4a6d-8206-5389910d8e47%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment