我有:
<>Schema
create_table "mouldings", :force => 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 => true do |t|
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
end
<><0>
class Moulding < ActiveRecord::Base
# Set up associations
belongs_to :suppliers
end
class Supplier < ActiveRecord::Base
# Associations
has_many :mouldings, :dependent => :destroy
end
<><><><><>><>>>><>>>>>>
def show
@moulding = Moulding.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @moulding }
end
end
我想加入两个表格,以便我能够把供应商的名字列入一个观点。 谁是控制者正确的辛迪加?