Hi all, I trying to load two similar Rails Engine in single app .. In my app Engine A like a core and engine B like a specific to some other purpose. In this two engines have many models,some models have shared in both engines. In this i faced one problem if i shared the model means all the method is not loaded correctly.. .Ex,i have article model in both engines Engine A have 5 methods and i have over-ride the model in Engine B it has 2 function. what i thought is Engine B article model have Engine A and Engine B methods ,but what it''s happen article model have only Engine B model methods only. if i load manually means it working correctly. I have load one engine in one single app it is working correctly.. Please tell me how to load 2 similar engines in one single app... in Gem file i have loaded the engine ->>> gem ''core-engine'', :path => ''Engines/core-engine'' gem ''microsite'', :path => ''Engines/microsite'' Thanks. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Wael M. Nasreddine
2012-May-28 09:55 UTC
Re: loading two similar Rails Engine in single app
Hey, This is a question for rubyonrails-talk, as this mailing list is reserved for Core members discussing Rails development. So please post your questions there,see this (http://rubyweekly.us1.list-manage.com/track/click?u=0618f6a79d6bb9675f313ceb2&id=fe470bc520&e=23d29988a2) presentation for better overview of Rails Engine. Cheers, Wael -- Wael Nasreddine: Design & Coding at TechnoGate (http://www.technogate.fr/) contact | wael.nasreddine@gmail.com (mailto:wael.nasreddine@gmail.com) - +33.6.51.24.04.34 | skype - eMxyzptlk (skype:eMxyzptlk?add) | Github - eMxyzptlk (https://github.com/eMxyzptlk) On Monday, May 28, 2012 at 11:25 AM, kingston.s wrote:> Hi all, > > I trying to load two similar Rails Engine in single app > .. > > In my app Engine A like a core and engine B like a specific to some > other purpose. > In this two engines have many models,some models have shared in both > engines. > > In this i faced one problem if i shared the model means all the method > is not loaded correctly.. > .Ex,i have article model in both engines Engine A have 5 methods and i > have over-ride the model in Engine B it has 2 function. > what i thought is Engine B article model have Engine A and Engine B > methods > ,but what it''s happen article model have only Engine B model methods > only. > > if i load manually means it working correctly. > I have load one engine in one single app it is working correctly.. > Please tell me how to load 2 similar engines in one single app... > > in Gem file i have loaded the engine ->>> > > gem ''core-engine'', :path => ''Engines/core-engine'' > gem ''microsite'', :path => ''Engines/microsite'' > > > > Thanks. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com (mailto:rubyonrails-core@googlegroups.com). > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com (mailto:rubyonrails-core+unsubscribe@googlegroups.com). > For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Short answer is: namespace your models, for example you should have Blog::Post instead of Post. And as already been said, this is not a question for rubyonrails-core. On Mon, May 28, 2012 at 11:55 AM, Wael M. Nasreddine < wael.nasreddine@gmail.com> wrote:> Hey, > > This is a question for rubyonrails-talk, as this mailing list is reserved > for Core members discussing Rails development. So please post your > questions there,see this<http://rubyweekly.us1.list-manage.com/track/click?u=0618f6a79d6bb9675f313ceb2&id=fe470bc520&e=23d29988a2> presentation for > better overview of Rails Engine. > > Cheers, > Wael > > -- > *Wael Nasreddine*: Design & Coding at TechnoGate<http://www.technogate.fr/> > contact | wael.nasreddine@gmail.com - +33.6.51.24.04.34 | skype - > eMxyzptlk | Github - eMxyzptlk <https://github.com/eMxyzptlk> > > On Monday, May 28, 2012 at 11:25 AM, kingston.s wrote: > > Hi all, > > I trying to load two similar Rails Engine in single app > .. > > In my app Engine A like a core and engine B like a specific to some > other purpose. > In this two engines have many models,some models have shared in both > engines. > > In this i faced one problem if i shared the model means all the method > is not loaded correctly.. > .Ex,i have article model in both engines Engine A have 5 methods and i > have over-ride the model in Engine B it has 2 function. > what i thought is Engine B article model have Engine A and Engine B > methods > ,but what it''s happen article model have only Engine B model methods > only. > > if i load manually means it working correctly. > I have load one engine in one single app it is working correctly.. > Please tell me how to load 2 similar engines in one single app... > > in Gem file i have loaded the engine ->>> > > gem ''core-engine'', :path => ''Engines/core-engine'' > gem ''microsite'', :path => ''Engines/microsite'' > > > > Thanks. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. >-- Piotr Sarnacki http://piotrsarnacki.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Thanks for quick reply... I have not used isolate_namespace concept... controller also not loaded like models... cau u plz tell me any other solution On May 28, 3:34 pm, Piotr Sarnacki <dro...@gmail.com> wrote:> Short answer is: namespace your models, for example you should have > Blog::Post instead of Post. > > And as already been said, this is not a question for rubyonrails-core. > > On Mon, May 28, 2012 at 11:55 AM, Wael M. Nasreddine < > > > > > > > > > > wael.nasredd...@gmail.com> wrote: > > Hey, > > > This is a question for rubyonrails-talk, as this mailing list is reserved > > for Core members discussing Rails development. So please post your > > questions there,see this<http://rubyweekly.us1.list-manage.com/track/click?u=0618f6a79d6bb9675...> presentation for > > better overview of Rails Engine. > > > Cheers, > > Wael > > > -- > > *Wael Nasreddine*: Design & Coding at TechnoGate<http://www.technogate.fr/> > > contact | wael.nasredd...@gmail.com - +33.6.51.24.04.34 | skype - > > eMxyzptlk | Github - eMxyzptlk <https://github.com/eMxyzptlk> > > > On Monday, May 28, 2012 at 11:25 AM, kingston.s wrote: > > > Hi all, > > > I trying to load two similar Rails Engine in single app > > .. > > > In my app Engine A like a core and engine B like a specific to some > > other purpose. > > In this two engines have many models,some models have shared in both > > engines. > > > In this i faced one problem if i shared the model means all the method > > is not loaded correctly.. > > .Ex,i have article model in both engines Engine A have 5 methods and i > > have over-ride the model in Engine B it has 2 function. > > what i thought is Engine B article model have Engine A and Engine B > > methods > > ,but what it''s happen article model have only Engine B model methods > > only. > > > if i load manually means it working correctly. > > I have load one engine in one single app it is working correctly.. > > Please tell me how to load 2 similar engines in one single app... > > > in Gem file i have loaded the engine ->>> > > > gem ''core-engine'', :path => ''Engines/core-engine'' > > gem ''microsite'', :path => ''Engines/microsite'' > > > Thanks. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Ruby on Rails: Core" group. > > To post to this group, send email to rubyonrails-core@googlegroups.com. > > To unsubscribe from this group, send email to > > rubyonrails-core+unsubscribe@googlegroups.com. > > For more options, visit this group at > >http://groups.google.com/group/rubyonrails-core?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Ruby on Rails: Core" group. > > To post to this group, send email to rubyonrails-core@googlegroups.com. > > To unsubscribe from this group, send email to > > rubyonrails-core+unsubscribe@googlegroups.com. > > For more options, visit this group at > >http://groups.google.com/group/rubyonrails-core?hl=en. > > -- > Piotr Sarnackihttp://piotrsarnacki.com-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Piotr Sarnacki
2012-May-28 12:56 UTC
Re: Re: loading two similar Rails Engine in single app
You should almost always namespace your models in engine, no matter if you use isolate_namespace or not. Please read the engines guide to see what isolated_namespace changes: http://edgeguides.rubyonrails.org/engines.html On Mon, May 28, 2012 at 2:27 PM, kingston.s <jenorishstar@gmail.com> wrote:> Thanks for quick reply... > > I have not used isolate_namespace concept... > > controller also not loaded like models... > > cau u plz tell me any other solution > > On May 28, 3:34 pm, Piotr Sarnacki <dro...@gmail.com> wrote: > > Short answer is: namespace your models, for example you should have > > Blog::Post instead of Post. > > > > And as already been said, this is not a question for rubyonrails-core. > > > > On Mon, May 28, 2012 at 11:55 AM, Wael M. Nasreddine < > > > > > > > > > > > > > > > > > > > > wael.nasredd...@gmail.com> wrote: > > > Hey, > > > > > This is a question for rubyonrails-talk, as this mailing list is > reserved > > > for Core members discussing Rails development. So please post your > > > questions there,see this< > http://rubyweekly.us1.list-manage.com/track/click?u=0618f6a79d6bb9675...> > presentation for > > > better overview of Rails Engine. > > > > > Cheers, > > > Wael > > > > > -- > > > *Wael Nasreddine*: Design & Coding at TechnoGate< > http://www.technogate.fr/> > > > contact | wael.nasredd...@gmail.com - +33.6.51.24.04.34 | skype - > > > eMxyzptlk | Github - eMxyzptlk <https://github.com/eMxyzptlk> > > > > > On Monday, May 28, 2012 at 11:25 AM, kingston.s wrote: > > > > > Hi all, > > > > > I trying to load two similar Rails Engine in single app > > > .. > > > > > In my app Engine A like a core and engine B like a specific to some > > > other purpose. > > > In this two engines have many models,some models have shared in both > > > engines. > > > > > In this i faced one problem if i shared the model means all the method > > > is not loaded correctly.. > > > .Ex,i have article model in both engines Engine A have 5 methods and i > > > have over-ride the model in Engine B it has 2 function. > > > what i thought is Engine B article model have Engine A and Engine B > > > methods > > > ,but what it''s happen article model have only Engine B model methods > > > only. > > > > > if i load manually means it working correctly. > > > I have load one engine in one single app it is working correctly.. > > > Please tell me how to load 2 similar engines in one single app... > > > > > in Gem file i have loaded the engine ->>> > > > > > gem ''core-engine'', :path => ''Engines/core-engine'' > > > gem ''microsite'', :path => ''Engines/microsite'' > > > > > Thanks. > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "Ruby on Rails: Core" group. > > > To post to this group, send email to rubyonrails-core@googlegroups.com > . > > > To unsubscribe from this group, send email to > > > rubyonrails-core+unsubscribe@googlegroups.com. > > > For more options, visit this group at > > >http://groups.google.com/group/rubyonrails-core?hl=en. > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "Ruby on Rails: Core" group. > > > To post to this group, send email to rubyonrails-core@googlegroups.com > . > > > To unsubscribe from this group, send email to > > > rubyonrails-core+unsubscribe@googlegroups.com. > > > For more options, visit this group at > > >http://groups.google.com/group/rubyonrails-core?hl=en. > > > > -- > > Piotr Sarnackihttp://piotrsarnacki.com > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. > >-- Piotr Sarnacki http://piotrsarnacki.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
My model like this only....... class Site < ActiveRecord::Base def view_path "#{SITES_ROOT}/#{self.template.name}/views" end def jeno self.short_name end end what can i do for this ......??? On May 28, 5:56 pm, Piotr Sarnacki <dro...@gmail.com> wrote:> You should almost always namespace your models in engine, no matter if you > use isolate_namespace or not. Please read the engines guide to see what > isolated_namespace changes:http://edgeguides.rubyonrails.org/engines.html > > > > > > > > > > On Mon, May 28, 2012 at 2:27 PM, kingston.s <jenorishs...@gmail.com> wrote: > > Thanks for quick reply... > > > I have not used isolate_namespace concept... > > > controller also not loaded like models... > > > cau u plz tell me any other solution > > > On May 28, 3:34 pm, Piotr Sarnacki <dro...@gmail.com> wrote: > > > Short answer is: namespace your models, for example you should have > > > Blog::Post instead of Post. > > > > And as already been said, this is not a question for rubyonrails-core. > > > > On Mon, May 28, 2012 at 11:55 AM, Wael M. Nasreddine < > > > > wael.nasredd...@gmail.com> wrote: > > > > Hey, > > > > > This is a question for rubyonrails-talk, as this mailing list is > > reserved > > > > for Core members discussing Rails development. So please post your > > > > questions there,see this< > >http://rubyweekly.us1.list-manage.com/track/click?u=0618f6a79d6bb9675...> > > presentation for > > > > better overview of Rails Engine. > > > > > Cheers, > > > > Wael > > > > > -- > > > > *Wael Nasreddine*: Design & Coding at TechnoGate< > >http://www.technogate.fr/> > > > > contact | wael.nasredd...@gmail.com - +33.6.51.24.04.34 | skype - > > > > eMxyzptlk | Github - eMxyzptlk <https://github.com/eMxyzptlk> > > > > > On Monday, May 28, 2012 at 11:25 AM, kingston.s wrote: > > > > > Hi all, > > > > > I trying to load two similar Rails Engine in single app > > > > .. > > > > > In my app Engine A like a core and engine B like a specific to some > > > > other purpose. > > > > In this two engines have many models,some models have shared in both > > > > engines. > > > > > In this i faced one problem if i shared the model means all the method > > > > is not loaded correctly.. > > > > .Ex,i have article model in both engines Engine A have 5 methods and i > > > > have over-ride the model in Engine B it has 2 function. > > > > what i thought is Engine B article model have Engine A and Engine B > > > > methods > > > > ,but what it''s happen article model have only Engine B model methods > > > > only. > > > > > if i load manually means it working correctly. > > > > I have load one engine in one single app it is working correctly.. > > > > Please tell me how to load 2 similar engines in one single app... > > > > > in Gem file i have loaded the engine ->>> > > > > > gem ''core-engine'', :path => ''Engines/core-engine'' > > > > gem ''microsite'', :path => ''Engines/microsite'' > > > > > Thanks. > > > > > -- > > > > You received this message because you are subscribed to the Google > > Groups > > > > "Ruby on Rails: Core" group. > > > > To post to this group, send email to rubyonrails-core@googlegroups.com > > . > > > > To unsubscribe from this group, send email to > > > > rubyonrails-core+unsubscribe@googlegroups.com. > > > > For more options, visit this group at > > > >http://groups.google.com/group/rubyonrails-core?hl=en. > > > > > -- > > > > You received this message because you are subscribed to the Google > > Groups > > > > "Ruby on Rails: Core" group. > > > > To post to this group, send email to rubyonrails-core@googlegroups.com > > . > > > > To unsubscribe from this group, send email to > > > > rubyonrails-core+unsubscribe@googlegroups.com. > > > > For more options, visit this group at > > > >http://groups.google.com/group/rubyonrails-core?hl=en. > > > > -- > > > Piotr Sarnackihttp://piotrsarnacki.com > > > -- > > You received this message because you are subscribed to the Google Groups > > "Ruby on Rails: Core" group. > > To post to this group, send email to rubyonrails-core@googlegroups.com. > > To unsubscribe from this group, send email to > > rubyonrails-core+unsubscribe@googlegroups.com. > > For more options, visit this group at > >http://groups.google.com/group/rubyonrails-core?hl=en. > > -- > Piotr Sarnackihttp://piotrsarnacki.com-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Luís Ferreira
2012-May-28 13:18 UTC
Re: Re: loading two similar Rails Engine in single app
Hi, I''ll answer you directly, since this is not something to be discussed in rails core. When writing engines, it is a good practice to namespace them http://edgeapi.rubyonrails.org/classes/Rails/Engine.html#label-Isolated+Engine And so you would have a CoreEngine::Article and a Microsite::Article and there would be no conflicts or functionality sharing. But for what I understood of your email, you want microsite to inherit from core_engine. What I would do is still namespace them and then make the microsite inherit from it, like so: # core_engine/models/core_engine/article.rb class CoreEngine::Article < ActiveRecord::Base ... end # microsite/models/microsite/article.rb class Microsite::Article < CoreEngine::Article ... end If you really need to call it Article in your main app, you can do this: # core_engine/models/article.rb class ::Article < ActiveRecord::Base ... end # microsite/models/article.rb class Article < ::Article ... end Bare in mind though that in this solution microsite''s article is inheriting from the application article, which means you will have to make sure core_engine loads to the app before microsite. Hope it helps. ;) On May 28, 2012, at 2:13 PM, kingston.s wrote:> My model like this only....... > class Site < ActiveRecord::Base > > def view_path > "#{SITES_ROOT}/#{self.template.name}/views" > end > > > def jeno > self.short_name > end > > end > what can i do for this ......??? > On May 28, 5:56 pm, Piotr Sarnacki <dro...@gmail.com> wrote: >> You should almost always namespace your models in engine, no matter if you >> use isolate_namespace or not. Please read the engines guide to see what >> isolated_namespace changes:http://edgeguides.rubyonrails.org/engines.html >> >> >> >> >> >> >> >> >> >> On Mon, May 28, 2012 at 2:27 PM, kingston.s <jenorishs...@gmail.com> wrote: >>> Thanks for quick reply... >> >>> I have not used isolate_namespace concept... >> >>> controller also not loaded like models... >> >>> cau u plz tell me any other solution >> >>> On May 28, 3:34 pm, Piotr Sarnacki <dro...@gmail.com> wrote: >>>> Short answer is: namespace your models, for example you should have >>>> Blog::Post instead of Post. >> >>>> And as already been said, this is not a question for rubyonrails-core. >> >>>> On Mon, May 28, 2012 at 11:55 AM, Wael M. Nasreddine < >> >>>> wael.nasredd...@gmail.com> wrote: >>>>> Hey, >> >>>>> This is a question for rubyonrails-talk, as this mailing list is >>> reserved >>>>> for Core members discussing Rails development. So please post your >>>>> questions there,see this< >>> http://rubyweekly.us1.list-manage.com/track/click?u=0618f6a79d6bb9675...> >>> presentation for >>>>> better overview of Rails Engine. >> >>>>> Cheers, >>>>> Wael >> >>>>> -- >>>>> *Wael Nasreddine*: Design & Coding at TechnoGate< >>> http://www.technogate.fr/> >>>>> contact | wael.nasredd...@gmail.com - +33.6.51.24.04.34 | skype - >>>>> eMxyzptlk | Github - eMxyzptlk <https://github.com/eMxyzptlk> >> >>>>> On Monday, May 28, 2012 at 11:25 AM, kingston.s wrote: >> >>>>> Hi all, >> >>>>> I trying to load two similar Rails Engine in single app >>>>> .. >> >>>>> In my app Engine A like a core and engine B like a specific to some >>>>> other purpose. >>>>> In this two engines have many models,some models have shared in both >>>>> engines. >> >>>>> In this i faced one problem if i shared the model means all the method >>>>> is not loaded correctly.. >>>>> .Ex,i have article model in both engines Engine A have 5 methods and i >>>>> have over-ride the model in Engine B it has 2 function. >>>>> what i thought is Engine B article model have Engine A and Engine B >>>>> methods >>>>> ,but what it''s happen article model have only Engine B model methods >>>>> only. >> >>>>> if i load manually means it working correctly. >>>>> I have load one engine in one single app it is working correctly.. >>>>> Please tell me how to load 2 similar engines in one single app... >> >>>>> in Gem file i have loaded the engine ->>> >> >>>>> gem ''core-engine'', :path => ''Engines/core-engine'' >>>>> gem ''microsite'', :path => ''Engines/microsite'' >> >>>>> Thanks. >> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>> Groups >>>>> "Ruby on Rails: Core" group. >>>>> To post to this group, send email to rubyonrails-core@googlegroups.com >>> . >>>>> To unsubscribe from this group, send email to >>>>> rubyonrails-core+unsubscribe@googlegroups.com. >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/rubyonrails-core?hl=en. >> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>> Groups >>>>> "Ruby on Rails: Core" group. >>>>> To post to this group, send email to rubyonrails-core@googlegroups.com >>> . >>>>> To unsubscribe from this group, send email to >>>>> rubyonrails-core+unsubscribe@googlegroups.com. >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/rubyonrails-core?hl=en. >> >>>> -- >>>> Piotr Sarnackihttp://piotrsarnacki.com >> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Ruby on Rails: Core" group. >>> To post to this group, send email to rubyonrails-core@googlegroups.com. >>> To unsubscribe from this group, send email to >>> rubyonrails-core+unsubscribe@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/rubyonrails-core?hl=en. >> >> -- >> Piotr Sarnackihttp://piotrsarnacki.com > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. >Cumprimentos, Luís Ferreira -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.