次のクラスがあります
class TableA < ActiveRecord::Base
has_one :tableb
end
class TableB < < ActiveRecord::Base
belongs_to :tableA
end
私はtableA/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に保存できるようになります。
ありがとう