Hi all.
First of all: I have 4 tables:
1) `respondents` with `id` and `email`.
2) `inquires` with id, question_id, `respondent_id`
3) `question_id` with `id` and `text`
4) `answers` with `inquiry_id`, `text`
What i want? I want to do next: in my view I have `question` and `text_field` and `button`. If user something answer on question and press button, this data inserts into `answer` table.
#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 through i something missed in view & controller. Data not pasting now. Please help!