Hi to all, I''ve 3 simple (I hope) questions about rails application design: 1. I''m developing a RoR application with some tables, every table has a boolean column (is_active), this column/property determines if the object is active or not. My question is "what is the best practice to implement this kind of problem ?": 1.1 - Have boolean is_active on each table with one base class ? (but without STI because every class/table have separated content...) 1.2 - Have an interface "Activable" on a separate table with a single boolean column is_active then in every table create an active object through activable interface ? 1.3 - Other solutions ? 2. On the same application all the tables/objects belongs to customer (multi site app) my question is "is it correct to propagate the customer_id foreign key to all the tables or is it better to have a "customerable" interface and link all the objects with has_one :customer through customerable ? 3. Last question: is it a good practice writing modular applications in which each one works only with a specialized database and handles linked restful resources from other applications ? Ex. News application handles only the news database and news objects, security application handles only the security database and security objects (in this scenario is it possible to have map.resources news, :as_one => security where security objects don''t belong to the same application ?) Many thanks in advance and happy programming with Ruby On Rails ! --~--~---------~--~----~------------~-------~--~----~ 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 For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
>>"what is the best practice to implement this kind of problem"1. I really don''t suggest implementing problems. This I''d say is a matter of personal preference. You can have a boolean on each object, and you can do things like Object.is_active? But if you have multiple Object classes, maybe you''ll want an activateable polymorphic class. You''ll have to consider which will have the most benefits for your situation. 2. What are you doing through customer for again? Unless you ahve many crazy relationships just ObjectType1 belongs_to :customer ObjectType2 belongs_to :customer :customer has_many :ObjectType1, :ObjectType2, etc On Feb 12, 9:17 am, Gianluca Tessarolo <tessarolo.gianl...-6ZZdBs7hMehZp5Udy/Obhg@public.gmane.org> wrote:> Hi to all, > > I''ve 3 simple (I hope) questions about rails application design: > > 1. I''m developing a RoR application with some tables, every table has a > boolean column (is_active), this column/property determines if the > object is active or not. My question is "what is the best practice to > implement this kind of problem ?": > > 1.1 - Have boolean is_active on each table with one base class ? (but > without STI because every class/table have separated content...) > 1.2 - Have an interface "Activable" on a separate table with a single > boolean column is_active then in every table create an active object > through activable interface ? > 1.3 - Other solutions ? > > 2. On the same application all the tables/objects belongs to customer > (multi site app) my question is "is it correct to propagate the > customer_id foreign key to all the tables or is it better to have a > "customerable" interface and link all the objects with has_one :customer > through customerable ? > > 3. Last question: is it a good practice writing modular applications in > which each one works only with a specialized database and handles linked > restful resources from other applications ? > Ex. News application handles only the news database and news > objects, security application handles only the security database and > security objects (in this scenario is it possible > to have map.resources news, :as_one => security where security > objects don''t belong to the same application ?) > > Many thanks in advance and happy programming with Ruby On Rails !--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks I choose to stay with the column is_active and customer_id in every table, after all this is the best way for high speed (no relation at all...). Have a nice day.>>> "what is the best practice to implement this kind of problem" >>> > > 1. I really don''t suggest implementing problems. > This I''d say is a matter of personal preference. You can have a > boolean on each object, and you can do things like Object.is_active? > > But if you have multiple Object classes, maybe you''ll want an > activateable polymorphic class. You''ll have to consider which will > have the most benefits for your situation. > > 2. What are you doing through customer for again? Unless you ahve many > crazy relationships just > ObjectType1 belongs_to :customer > ObjectType2 belongs_to :customer > > :customer has_many :ObjectType1, :ObjectType2, etc > > On Feb 12, 9:17 am, Gianluca Tessarolo > <tessarolo.gianl...-6ZZdBs7hMehZp5Udy/Obhg@public.gmane.org> wrote: > >> Hi to all, >> >> I''ve 3 simple (I hope) questions about rails application design: >> >> 1. I''m developing a RoR application with some tables, every table has a >> boolean column (is_active), this column/property determines if the >> object is active or not. My question is "what is the best practice to >> implement this kind of problem ?": >> >> 1.1 - Have boolean is_active on each table with one base class ? (but >> without STI because every class/table have separated content...) >> 1.2 - Have an interface "Activable" on a separate table with a single >> boolean column is_active then in every table create an active object >> through activable interface ? >> 1.3 - Other solutions ? >> >> 2. On the same application all the tables/objects belongs to customer >> (multi site app) my question is "is it correct to propagate the >> customer_id foreign key to all the tables or is it better to have a >> "customerable" interface and link all the objects with has_one :customer >> through customerable ? >> >> 3. Last question: is it a good practice writing modular applications in >> which each one works only with a specialized database and handles linked >> restful resources from other applications ? >> Ex. News application handles only the news database and news >> objects, security application handles only the security database and >> security objects (in this scenario is it possible >> to have map.resources news, :as_one => security where security >> objects don''t belong to the same application ?) >> >> Many thanks in advance and happy programming with Ruby On Rails ! >> > > > > >-- Gianluca Tessarolo TreNetMediaMaster S.r.l. The Internet Technology Company Telefono +39(049)776196 Fax +39(049)8087806 Visit us @: http://www.trenet.it - http://www.mediamaster.it e-mail me @: tessarolo.gianluca-6ZZdBs7hMehZp5Udy/Obhg@public.gmane.org ---------------------------------------------------------------------- Le informazioni trasmesse sono destinate esclusivamente alla persona o alla società in indirizzo e sono da intendersi confidenziali e riservate. Ogni trasmissione, inoltro, diffusione o altro uso di queste informazioni a persone o società differenti dal destinatario é proibita. Se ricevete questa comunicazione per errore, contattate il mittente e cancellate le informazioni da ogni computer. --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---