title: Ruby on Rails - Join Two Tables
body: <p>I have the following:</p>
  
  <p><strong>Schema</strong></p>
  
  <pre><code>create_table "mouldings", :force =&gt; true do |t|
    t.string   "suppliers_code"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "name"
    t.integer  "supplier_id"
    t.decimal  "length"
    t.decimal  "cost"
    t.decimal  "width"
    t.decimal  "depth"
  end
  
  create_table "suppliers", :force =&gt; true do |t|
    t.string   "name"
    t.datetime "created_at"
    t.datetime "updated_at"
  end
  </code></pre>
  
  <p><strong>Models</strong></p>
  
  <pre><code>class Moulding &lt; ActiveRecord::Base
  
    # Set up associations
    belongs_to :suppliers
  
  end
  
  class Supplier &lt; ActiveRecord::Base
  
    # Associations
    has_many :mouldings, :dependent =&gt; :destroy
  
  end
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>  def show
      @moulding = Moulding.find(params[:id])
  
      respond_to do |format|
        format.html # show.html.erb
        format.xml  { render :xml =&gt; @moulding }
      end
   end
  </code></pre>
  
  <p>I want to join the two tables so I can include the supplier's name in a view.  What is the correct syntax for the controller?</p>