如何使用belongs_to和has_many关系(使用formtastic)制作表单?

时间:2011-06-15 02:28:21

标签: ruby-on-rails autocomplete has-many formtastic belongs-to

这是我目前的表格。现在,我不认为它是在添加/创建帐户记录:

  1 = semantic_form_for @message do |f|
  2   #message_form
  3     = f.error_messages
  4     %p
  5       = f.autocompleted_input :account, :url => autocomplete_account_name_messages_path
  6     %p
  7       = f.input :subject
  8       %br
  9       = f.input :body, :as => :text, :input_html => { :class => 'autogrow', :rows => 5, :cols => 20, :maxlength => 10  }
 10     = hidden_field_tag :sender_id, params[:sender_id]
 11     = hidden_field_tag :receiver_id, params[:id]
 12     
 13     = f.buttons do 
 14       = f.commit_button 'Give'
 15       = f.commit_button 'Request'
 16     
 17   #add_contact_btn
 18     = link_to "Add Contact", new_contact_path
 19       
 20     #contact_form
 21       = form_for @contact do |fc|
 22         %p
 23           = fc.label :first_name
 24           %br
 25           = fc.text_field :first_name
 26         %p
 27           = fc.label :last_name
 28           %br 
 29           = fc.text_field :last_name
 30   

0 个答案:

没有答案