-
-
Save adamjgrant/5807116 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##### ERROR | |
undefined method `question_path' for #<#<Class:0x007fa183901da8>:0x007fa1838e2ca0> | |
##### VIEW | |
<% @questions.each do |question| %> | |
<tr> | |
<td><a href="/surveys/<%= @survey.id %>/questions/<%= question.id %>/"><%= question.question %></td> | |
<td><%= question.qtype %></td> | |
<td> | |
<!-- Deleting this gets rid of the error. --> | |
<%= link_to 'Delete', question, :confirm => 'Are you Sure?', :method => :delete %> | |
</td> | |
</tr> | |
<% end %> | |
##### CONTROLLER | |
def show | |
@survey = Survey.find(params[:id]) | |
@questions = @survey.questions | |
respond_to do |format| | |
format.html # show.html.erb | |
format.json { render :json => @survey } | |
end | |
end | |
### ROUTES | |
survey_questions GET /surveys/:survey_id/questions(.:format) questions#index | |
POST /surveys/:survey_id/questions(.:format) questions#create | |
new_survey_question GET /surveys/:survey_id/questions/new(.:format) questions#new | |
edit_survey_question GET /surveys/:survey_id/questions/:id/edit(.:format) questions#edit | |
survey_question GET /surveys/:survey_id/questions/:id(.:format) questions#show | |
PUT /surveys/:survey_id/questions/:id(.:format) questions#update | |
DELETE /surveys/:survey_id/questions/:id(.:format) questions#destroy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment