Basing on the route definition you provided, the edit path for questions should be teacher/lessons/1/questions/1/edit
and not teachers/1/questions/1/edit
.
You could refer to the guides for how to use namespaces in routes: http://guides.rubyonrails.org/routing.html#controller-namespaces-and-routing
Your form should probably look like this:
= simple_form_for [:teacher, @lesson, @question], :html => { :class => 'form-horizontal form-lineup' } do |f|
Or try:
= simple_form_for @question, :html => { :class => 'form-horizontal form-lineup' }, url: edit_teacher_lesson_question_path(@lesson, @question), method: :put do |f|
If you want to produce this path teachers/1/questions/1/edit
, you need to define the route this way:
resources :teachers do
resources :questions
end