Hi everyone- Going with DRY, I have created one table to hold all of the items my customer may have, but I will need to create different input forms since some columns will need to show for some items and not others. I generated my scaffold for the admin section and it works great since every column in the items table shows - now I would like to create different input forms for the different products. Is it a matter of ruby script/generate scaffold <name of form input> Admin. Thanks for your help in advance and patience with a newbie. -Scott --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I think you want to generate a different partial depending on the item, and then just pass the partial name into the view that you are rendering. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Scott Parks
2006-Dec-04 16:41 UTC
Re: DRY to the rescue, displaying only portions of table
On Dec 4, 2006, at 12:04 AM, Joe wrote:> I think you want to generate a different partial depending on the > item, > and then just pass the partial name into the view that you are > rendering.Hi Joe- On the customer side I created this in the product model: def self.salable_items find(:all, :conditions => "producttype = ''Product''", #:conditions => "dateactive <= now()", :order => "title desc") end def self.magazine_items find(:all, :conditions => "producttype = ''Magazine''", #:conditions => "dateactive <= now()", :order => "title desc") end Which gives me the display on the front end. My question now is building the admin side of it, which I sent as a separate question. Thank you! -Scott --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
You might want to look at STI, but it''s a bit flaky if you use polymorphic associations down the line. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---