Hi, I''m new to this list and to rails, so I''m sorry if this subject is repetead or too obvious. I have two models: Topic and University, both in production. I want to make University to inherit from Topic, but when I do this: University < Topic My universities data just disapear (and reapears if the changes are undone). I''m using mongomapper and mongodb. The code is pretty big sp I''ll post then only if necessarily. I think this must be easy to solve. ps: I''ve tried the deprecated _type but didn''t work. Thanks ! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jan 21, 10:03 pm, Pedro Bernardes <fedor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, I''m new to this list and to rails, so I''m sorry if this subject is > repetead or too obvious. > > I have two models: Topic and University, both in production. I want to make > University to inherit from Topic, but when I do this: > > University < Topic > > My universities data just disapear (and reapears if the changes are undone). >Are you trying to setup a single table inheritance type thing? When you say that your universities data disappears, do you mean that University.all no longer returns any data? Switching from your previous setup to a single table inheritance situation means that mongomapper will be looking in the topics collection when you do University.all, so I''m not surprised that your university data would appear to vanish, if you haven''t done anything to move it from its previous collection. Fred> I''m using mongomapper and mongodb. The code is pretty big sp I''ll post then > only if necessarily. I think this must be easy to solve. > > ps: I''ve tried the deprecated _type but didn''t work. > > Thanks !-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
This is exactly it, I''m trying to add the topics behavior to the default behavior of universities and University.all just returns [] How do I change the University? I was unable to find references to it. 2011/1/21 Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> > > On Jan 21, 10:03 pm, Pedro Bernardes <fedor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi, I''m new to this list and to rails, so I''m sorry if this subject is > > repetead or too obvious. > > > > I have two models: Topic and University, both in production. I want to > make > > University to inherit from Topic, but when I do this: > > > > University < Topic > > > > My universities data just disapear (and reapears if the changes are > undone). > > > > Are you trying to setup a single table inheritance type thing? When > you say that your universities data disappears, do you mean that > University.all no longer returns any data? > Switching from your previous setup to a single table inheritance > situation means that mongomapper will be looking in the topics > collection when you do University.all, so I''m not surprised that your > university data would appear to vanish, if you haven''t done anything > to move it from its previous collection. > > Fred > > > > I''m using mongomapper and mongodb. The code is pretty big sp I''ll post > then > > only if necessarily. I think this must be easy to solve. > > > > ps: I''ve tried the deprecated _type but didn''t work. > > > > Thanks ! > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jan 22, 3:39 am, Pedro Bernardes <fedor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> This is exactly it, I''m trying to add the topics behavior to the default > behavior of universities and University.all just returns [] > > How do I change the University? I was unable to find references to it. >I''ve only dabbled with mongomapper, but my understanding is that if you move from two separate collections to a single collection inheritance setup, you''re going to need to move all the data from the old universities collection to the topics collection Fred> 2011/1/21 Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > > > > > On Jan 21, 10:03 pm, Pedro Bernardes <fedor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi, I''m new to this list and to rails, so I''m sorry if this subject is > > > repetead or too obvious. > > > > I have two models: Topic and University, both in production. I want to > > make > > > University to inherit from Topic, but when I do this: > > > > University < Topic > > > > My universities data just disapear (and reapears if the changes are > > undone). > > > Are you trying to setup a single table inheritance type thing? When > > you say that your universities data disappears, do you mean that > > University.all no longer returns any data? > > Switching from your previous setup to a single table inheritance > > situation means that mongomapper will be looking in the topics > > collection when you do University.all, so I''m not surprised that your > > university data would appear to vanish, if you haven''t done anything > > to move it from its previous collection. > > > Fred > > > > I''m using mongomapper and mongodb. The code is pretty big sp I''ll post > > then > > > only if necessarily. I think this must be easy to solve. > > > > ps: I''ve tried the deprecated _type but didn''t work. > > > > Thanks ! > > > -- > > You received this message because you are subscribed to the Google Groups > > "Ruby on Rails: Talk" group. > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscrib e@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/rubyonrails-talk?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
but how would I do that since all the data is missing? well, thanks for the help! I''ll keep trying. 2011/1/22 Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> > > On Jan 22, 3:39 am, Pedro Bernardes <fedor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > This is exactly it, I''m trying to add the topics behavior to the default > > behavior of universities and University.all just returns [] > > > > How do I change the University? I was unable to find references to it. > > > > I''ve only dabbled with mongomapper, but my understanding is that if > you move from two separate collections to a single collection > inheritance setup, you''re going to need to move all the data from the > old universities collection to the topics collection > > Fred > > > 2011/1/21 Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > > > > > > > > > > > On Jan 21, 10:03 pm, Pedro Bernardes <fedor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi, I''m new to this list and to rails, so I''m sorry if this subject > is > > > > repetead or too obvious. > > > > > > I have two models: Topic and University, both in production. I want > to > > > make > > > > University to inherit from Topic, but when I do this: > > > > > > University < Topic > > > > > > My universities data just disapear (and reapears if the changes are > > > undone). > > > > > Are you trying to setup a single table inheritance type thing? When > > > you say that your universities data disappears, do you mean that > > > University.all no longer returns any data? > > > Switching from your previous setup to a single table inheritance > > > situation means that mongomapper will be looking in the topics > > > collection when you do University.all, so I''m not surprised that your > > > university data would appear to vanish, if you haven''t done anything > > > to move it from its previous collection. > > > > > Fred > > > > > > I''m using mongomapper and mongodb. The code is pretty big sp I''ll > post > > > then > > > > only if necessarily. I think this must be easy to solve. > > > > > > ps: I''ve tried the deprecated _type but didn''t work. > > > > > > Thanks ! > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "Ruby on Rails: Talk" group. > > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > . > > > To unsubscribe from this group, send email to > > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org><rubyonrails-talk%2Bunsubscrib > e@googlegroups.com> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jan 22, 12:39 pm, Pedro Bernardes <fedor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> but how would I do that since all the data is missing? >Can you see it using the mongo console? I reckon the data isn''t missing, mongomapper is just looking for it in the wrong collection. Fred> well, thanks for the help! I''ll keep trying. > > 2011/1/22 Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > > > > > On Jan 22, 3:39 am, Pedro Bernardes <fedor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > This is exactly it, I''m trying to add the topics behavior to the default > > > behavior of universities and University.all just returns [] > > > > How do I change the University? I was unable to find references to it. > > > I''ve only dabbled with mongomapper, but my understanding is that if > > you move from two separate collections to a single collection > > inheritance setup, you''re going to need to move all the data from the > > old universities collection to the topics collection > > > Fred > > > > 2011/1/21 Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > > > On Jan 21, 10:03 pm, Pedro Bernardes <fedor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hi, I''m new to this list and to rails, so I''m sorry if this subject > > is > > > > > repetead or too obvious. > > > > > > I have two models: Topic and University, both in production. I want > > to > > > > make > > > > > University to inherit from Topic, but when I do this: > > > > > > University < Topic > > > > > > My universities data just disapear (and reapears if the changes are > > > > undone). > > > > > Are you trying to setup a single table inheritance type thing? When > > > > you say that your universities data disappears, do you mean that > > > > University.all no longer returns any data? > > > > Switching from your previous setup to a single table inheritance > > > > situation means that mongomapper will be looking in the topics > > > > collection when you do University.all, so I''m not surprised that your > > > > university data would appear to vanish, if you haven''t done anything > > > > to move it from its previous collection. > > > > > Fred > > > > > > I''m using mongomapper and mongodb. The code is pretty big sp I''ll > > post > > > > then > > > > > only if necessarily. I think this must be easy to solve. > > > > > > ps: I''ve tried the deprecated _type but didn''t work. > > > > > > Thanks ! > > > > > -- > > > > You received this message because you are subscribed to the Google > > Groups > > > > "Ruby on Rails: Talk" group. > > > > To post to this group, send email to rubyonrails-talk@googlegroups.com > > . > > > > To unsubscribe from this group, send email to > > > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscrib e@googlegroups.com><rubyonrails-talk%2Bunsubscrib > > e@googlegroups.com> > > > > . > > > > For more options, visit this group at > > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Ruby on Rails: Talk" group. > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscrib e@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/rubyonrails-talk?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Yeah! It is solved, I just needed to resave all University data as Topics, with custom fields, and with the _type attribute. Thanks for the answers! 2011/1/22 Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> > > On Jan 22, 12:39 pm, Pedro Bernardes <fedor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > but how would I do that since all the data is missing? > > > > Can you see it using the mongo console? I reckon the data isn''t > missing, mongomapper is just looking for it in the wrong collection. > > Fred > > well, thanks for the help! I''ll keep trying. > > > > 2011/1/22 Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > > > > > > > > > > > On Jan 22, 3:39 am, Pedro Bernardes <fedor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > This is exactly it, I''m trying to add the topics behavior to the > default > > > > behavior of universities and University.all just returns [] > > > > > > How do I change the University? I was unable to find references to > it. > > > > > I''ve only dabbled with mongomapper, but my understanding is that if > > > you move from two separate collections to a single collection > > > inheritance setup, you''re going to need to move all the data from the > > > old universities collection to the topics collection > > > > > Fred > > > > > > 2011/1/21 Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > > > > > On Jan 21, 10:03 pm, Pedro Bernardes <fedor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > Hi, I''m new to this list and to rails, so I''m sorry if this > subject > > > is > > > > > > repetead or too obvious. > > > > > > > > I have two models: Topic and University, both in production. I > want > > > to > > > > > make > > > > > > University to inherit from Topic, but when I do this: > > > > > > > > University < Topic > > > > > > > > My universities data just disapear (and reapears if the changes > are > > > > > undone). > > > > > > > Are you trying to setup a single table inheritance type thing? When > > > > > you say that your universities data disappears, do you mean that > > > > > University.all no longer returns any data? > > > > > Switching from your previous setup to a single table inheritance > > > > > situation means that mongomapper will be looking in the topics > > > > > collection when you do University.all, so I''m not surprised that > your > > > > > university data would appear to vanish, if you haven''t done > anything > > > > > to move it from its previous collection. > > > > > > > Fred > > > > > > > > I''m using mongomapper and mongodb. The code is pretty big sp I''ll > > > post > > > > > then > > > > > > only if necessarily. I think this must be easy to solve. > > > > > > > > ps: I''ve tried the deprecated _type but didn''t work. > > > > > > > > Thanks ! > > > > > > > -- > > > > > You received this message because you are subscribed to the Google > > > Groups > > > > > "Ruby on Rails: Talk" group. > > > > > To post to this group, send email to > rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > . > > > > > To unsubscribe from this group, send email to > > > > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org><rubyonrails-talk%2Bunsubscrib > e@googlegroups.com><rubyonrails-talk%2Bunsubscrib > > > e@googlegroups.com> > > > > > . > > > > > For more options, visit this group at > > > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "Ruby on Rails: Talk" group. > > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > . > > > To unsubscribe from this group, send email to > > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org><rubyonrails-talk%2Bunsubscrib > e@googlegroups.com> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.