I am currently in the process of creating a ecommerce site and was
hoping I could ask for some feedback with the question below… Thank
you in advance!
Currently an order can have_many line_items. The line_items db table has
many fields which may or may not be used depending on the
product_type_id defined for that line_item. For example,
line_item.color may be null if the product_type_id is 1, where as if it
was 2 the line_item.color might be red.
To keep the view clean for viewing an actual line_item I was not sure
about the best way of doing this. At first glance I was thinking of
creating a partial view for each product_type. (Example -
Then I thought of hiding specific columns in the html table by checking
to see if that field is blank to keep it all as one view. If the latter
is the better idea, then what would be the best way of hiding the unused
There are currently 5 product_types, however a few more may be added in
the future. Not to throw more into the mix, but there may be other
partials to include depending upon the product_type_id as well. For
example, if the product_type_id is 1 or 2 then we must include this
other partial which would display the status updates for this line_item.
Where was if the product_type_id was 3 there are no status updates
associated with it.
I would appreciate any and all suggestions, as I am not sure would would
be the best / proper way of doing this.