2012-08-06 63 views
0

我有以下類做多的插入到表從視圖

class TableA < ActiveRecord::Base 
     has_one :tableb 
end 
class TableB < < ActiveRecord::Base 
     belongs_to :tableA 
end 

我有一個表A/form.html.erb

<%= form_for(@@table) do |f| %> 
    <%= f.text_field :tableAColumn %> 
    <%= f.text_field :tableAColumn1 %> 
    #how can i how this 
    <%= f.text_field :tableBColumn %> 
    <%=f.text_field :tableBColumn1 %> 
    <%= f.submit %> 
<%end> 

,以至於當我點擊保存兩個記錄可以被保存在表A和表B中

由於

回答