Hi, there. I was wondering if it''s possible to have one controller and view that has multiple tables. Let say there are 10 schools. Each school has a table to stores students'' info. So one Student controller with 10 tables. Is it possible or any workaround? Thanks in advances. -- Posted via http://www.ruby-forum.com/. -- 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.
Ichiro Saga wrote:> Hi, there. > I was wondering if it''s possible to have one controller and view that > has multiple tables. Let say there are 10 schools. Each school has a > table to stores students'' info. So one Student controller with 10 > tables. Is it possible or any workaround?That''s a terrible setup. You should never have multiple identical tables -- instead, all you need is one table for all students.> Thanks in advances.Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- 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.
Marnen Laibow-Koser wrote:> Ichiro Saga wrote: >> Hi, there. >> I was wondering if it''s possible to have one controller and view that >> has multiple tables. Let say there are 10 schools. Each school has a >> table to stores students'' info. So one Student controller with 10 >> tables. Is it possible or any workaround? > > That''s a terrible setup. You should never have multiple identical > tables -- instead, all you need is one table for all students. > >> Thanks in advances. > > Best, > -- > Marnen Laibow-Koser > http://www.marnen.org > marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.orgThanks Maren. When there are 30+ schools and each has 100k+ students, it''ll be a very large table. That''s why I was thinking about breaking it into some smaller tables. -- Posted via http://www.ruby-forum.com/. -- 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.
Ichiro Saga wrote:> That''s why I was thinking about breaking it into some > smaller tables.Don''t. A few 100k or million rows are nothing for a database. As long as you set up an index for the school_id, splitting the students in multiple tables has absolutely no advantage. -- Posted via http://www.ruby-forum.com/. -- 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.
Andreas S. wrote:> Ichiro Saga wrote: >> That''s why I was thinking about breaking it into some >> smaller tables. > > Don''t. A few 100k or million rows are nothing for a database. As long as > you set up an index for the school_id, splitting the students in > multiple tables has absolutely no advantage.Right. If you *must* break the table (which you probably won''t even need to do), then use your DB''s sharding features (such as MySQL''s MERGE tables) so that it still functions like one huge table. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- 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.
I second everybody else here. Add an identifier for the school in your table and you''ll be happier than with the setup you were going to use. On Feb 5, 12:21 pm, Ichiro Saga <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Marnen Laibow-Koser wrote: > > Ichiro Saga wrote: > >> Hi, there. > >> I was wondering if it''s possible to have one controller and view that > >> has multiple tables. Let say there are 10 schools. Each school has a > >> table to stores students'' info. So one Student controller with 10 > >> tables. Is it possible or any workaround? > > > That''s a terrible setup. You should never have multiple identical > > tables -- instead, all you need is one table for all students. > > >> Thanks in advances. > > > Best, > > -- > > Marnen Laibow-Koser > >http://www.marnen.org > > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > > Thanks Maren. > When there are 30+ schools and each has 100k+ students, it''ll be a very > large table. That''s why I was thinking about breaking it into some > smaller tables. > -- > Posted viahttp://www.ruby-forum.com/.-- 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.