mercredi 24 juillet 2019

Namespace nested resources

I have the following routes on my project:

namespace :teacher do
 resources job_applications do
   resources :job_application_addresses
 end


My form has the folling code

<%= simple_form_for [:teacher, @job_application_address] do |form|

<% end %>


And my controller has the following:

def new
 @job_application_address = JobApplicationAddress.new
end

def create
 @job_application_address = JobApplicationAddress.new(job_application_address_params)
 @job_application_address.job_application = @job_application
   if @job_application_address.save
    flash[:success] = 'Successfully created'
   end
end


Finally I'm getting this error:

undefined method `teacher_job_application_addresses_path' for #<#<Class:0x00007fda0c4191d0>:0x00007fda143d1af8>
Did you mean?  teacher_job_application_path
               teacher_job_applications_path

Extracted source (around line #3):
<%= simple_form_for [:teacher, @job_application_address] do |form| %>

What should I do? I'll apprecciate your help.

Aucun commentaire:

Enregistrer un commentaire