我有一个模式:
class Donor < ActiveRecord::Base #recipient has name:string email:string
has_one :recipient
end
class Recipient < ActiveRecord::Base #recipient has name:string address:string
end
捐助方已在数据库中居住。
我有以下路线:
match "/:donor" =>"pages#donation", :as => :donor
在这一行动中,我有:
@donor = Donor.find_by_name(params[:donor])
捐助者名单已经输入数据库。
我认为:
<%= form_for @donor do |f| %>
<div class="field">
<%= f.label :name, "Name" %> #this is prepopulated with their name - but they can change it.
<%= f.text_field :name, :class=>"input-text" %>
</div>
<div class="actions">
<%= f.submit "Submit" %>
</div>
<% end %>
我怎么能补充一些领域,把受援国的细节添加到这一表格中?