首先的數據表添加:我有4個表:通過另一個
1)respondents
與id
和email
。
2)inquires
與ID,question_id,respondent_id
3)question_id
與id
和text
4)answers
與inquiry_id
,text
我想要什麼?我想做下一步:在我看來,我有question
和text_field
和button
。 如果用戶回答問題並按下按鈕,該數據將插入answer
表中。
my_controller(asnwer_controller)
def create
if request.post?
Answer.create(:inquiry_id=>@inquiry.id.to_s, :text=>params[:text])
end
end
my_view
<% form_for :answer, :url => { :controller => 'answer', :action => 'create' } do |f| %>
<%= @questions.id %>. <%= @questions.text %><br />
<%= f.text_area :text, :rols => 10, :cols => 60 %><br />
<%= submit_tag "Send Survey ", :class => "inputBox" %>
<% end %>
我到i東西視圖&控制器錯過。數據現在不粘貼。請幫忙!
我通過這個幫助網頁,人們互相幫助,並不關心他們聲譽的1%,但我認爲我錯了。 – 2011-04-08 06:50:33
這是真的。但是你必須表明你關心社區。當人們幫助你時,通過點擊小檢查標誌來顯示你的確認並不壞。 – Spyros 2011-04-08 07:31:12
好吧!我只是在這裏呆了幾個月,我不知道這個按鈕在做什麼,現在我知道了,而且已經點擊了。 – 2011-04-08 07:33:22