Skip to content

Instantly share code, notes, and snippets.

@adamjgrant
Forked from anonymous/gist:5807012
Last active December 18, 2015 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamjgrant/5807116 to your computer and use it in GitHub Desktop.
Save adamjgrant/5807116 to your computer and use it in GitHub Desktop.
##### 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