I have a survey and I have survey_memberships. I have a field under survey_memberships which says whether they have completed the survey or not. By default it is 0. I want to set this to 1 using a form. I used to be setting completed under the surveys table which is why that is how it looks in my form below.
The form is under the survey controller. But the field I want to set now is under my survey_memberships form.
Here is what the form looks like.
<% form_for(:survey, :url => survey_path(@survey), :html => { :multipart => true, :method => :put }) do |f| %>
<p>
<%= hidden_field_tag 'survey[completed]', '1' %>
</p>
<p>
<%= submit_tag 'I am finished taking this survey'.l %> or <%= link_to 'Cancel and go back to all surveys'.l, surveys_path %>
</p>
<% end %>
I am pretty stupid in Rails. I can try to provide more details if you need them. Any help would be greatly appreciated.
Question
Jon 5
I have a survey and I have survey_memberships. I have a field under survey_memberships which says whether they have completed the survey or not. By default it is 0. I want to set this to 1 using a form. I used to be setting completed under the surveys table which is why that is how it looks in my form below.
The form is under the survey controller. But the field I want to set now is under my survey_memberships form.
Here is what the form looks like.
<% form_for(:survey, :url => survey_path(@survey), :html => { :multipart => true, :method => :put }) do |f| %> <p> <%= hidden_field_tag 'survey[completed]', '1' %> </p> <p> <%= submit_tag 'I am finished taking this survey'.l %> or <%= link_to 'Cancel and go back to all surveys'.l, surveys_path %> </p> <% end %>I am pretty stupid in Rails. I can try to provide more details if you need them. Any help would be greatly appreciated.
Link to comment
Share on other sites
2 answers to this question
Recommended Posts