Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As with most things: it depends. Each of your ideas have merit. If it were me, I'd start out this way: </p> <pre><code> class Product &lt; ActiveRecord::Base has_one :aws_item end class AWSItem belongs_to :product end </code></pre> <p>The key questions you want to ask yourself are: </p> <p><strong>Are you only going to be offering AWS ECS items, or will you have other products?</strong> If you'll have products that have nothing to do with Amazon, don't care about ASIN, etc, then a has_one could be the way to go. Or, even better, a polymorphic relationship to a :vendable interface so you can later plug in different extension types. </p> <p><strong>Is it just behavior that is different, or is the data going to be largely different too?</strong> Because you might want to consider: </p> <blockquote> <pre><code>class Product &lt; ActiveRecord::Base end class AWSItem &lt; Product def do_amazon_stuff ... end end </code></pre> </blockquote> <p><strong>How do you want the system to perform when Amazon ECS isn't available?</strong> Should it throw exceptions? Or should you rely on a local cached version of the catalog?</p> <blockquote> <pre><code>class Product &lt; ActiveRecord::Base end class ItemFetcher &lt; BackgrounDRb::Rails def do_work # .... Make a cached copy of your ECS catalog here. # Copy the Amazon stuff into your local model end end </code></pre> </blockquote> <p>Walk through these questions slowly and the answer will become clearer. If it doesn't, start prototyping it out. Good luck!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload