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
Admin.
Thanks for your help in advance and patience with a newbie.
-Scott
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.
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 might want to look at STI, but it’s a bit flaky if you use
polymorphic associations down the line.