When I refresh the page I get this error message:
ActionController::RoutingError (No route matches {:action=>"value", :controller=>"round"}):
app/views/surveys/survey.html.erb:28:in `block in _app_views_surveys_survey_html_erb___3955880096442191391_70175035205180'
app/views/surveys/survey.html.erb:22:in `_app_views_surveys_survey_html_erb___3955880096442191391_70175035205180'
app/controllers/surveys_controller.rb:16:in `block (2 levels) in survey'
app/controllers/surveys_controller.rb:14:in `survey'
Rendered /Users/pitosalas/.rvm/gems/ruby-1.9.3-p194@repeatsurvey/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.5ms)
I am very confused by this. Why is the reference to program_participant_round_value_path causing that route to be missing?
Here’s my routes file:
root to: 'programs#index'
resources :programs do
resources :participants do
get 'survey' => 'surveys#survey'
end
resources :questions
resources :rounds
member do
get 'report' => 'reports#report'
end
end
resources :program do
resources :participant do
resources :round do
put :value
end
end
end
And here’s the relevant rake routes line:
program_participant_round_value PUT /program/:program_id/participant/:participant_id/round/:round_id/value(.:format) round#value
I have a controller action round#value.
Here’s the relevant part of the view:
<%= content_tag :table do %>
<%= content_tag :thead do %>
<% 5.times do |q| %>
<%= content_tag :th, "1" %>
<% end %>
<% end %>
<% form_tag program_participant_round_value_path do %>
<%= content_tag :tbody do %>
<%= render partial: 'surveys/value', collection: @values %>
<% end %>
<%= submit_tag "Save" %>
<% end %>
<% end %>
Thanks!
Your
program_participant_round_valueroute is expecting several parameters::program_id:participant_id:round_idYou need to provide values for those parameters when you call the
program_participant_round_value_pathhelper:Of course, variable names and such may be slightly different depending on how you are defining them in the controller.