I have two models Jobs and Questions. A job has many questions and questions belong to a job. 
I've set up the resources in the model, as well as the routes. I am having an issue trying to link_to the Show method of the questions controller on the questions#index page. My rake routes say that the path should be job_question_path with the two necessary :id's being :job_id and :id , so I tried:

&lt;td&gt;&lt;%= link_to 'Show', job_question_path(@job, question) %&gt;&lt;/td&gt;


 

and got the error:

No route matches {:action=&gt;"show", :controller=&gt;"questions", :job_id=&gt;nil, :id=&gt;#&lt;Question id: 1, job_id: 1, question1: "sfsdfssfs", question2: "sfsdfs", question3: "sfsdf", question4: "sfsdfsf", question5: "sfsfsfs", created_at: "2011-06-21 03:25:12", updated_at: "2011-06-21 03:25:12"&gt;}


I've tried multiple other combos and nothing is seeming to work, I keep getting:

No route matches {:action=&gt;"show", :controller=&gt;"questions", :job_id=&gt;nil } 


or some combination of that.

The part I don't get is that I can put in the url /jobs/1/questions/1 and it takes me to the show page, so I am assuming that my questions#show methods are ok. See below for the rest of my code. 

Questions#index view

&lt;% @questions.each do |question| %&gt;
 &lt;tr&gt;
  &lt;td&gt;&lt;%= question.question1 %&gt;&lt;/td&gt;
  &lt;td&gt;&lt;%= question.question2 %&gt;&lt;/td&gt;
  &lt;td&gt;&lt;%= question.question3 %&gt;&lt;/td&gt;
  &lt;td&gt;&lt;%= question.question4 %&gt;&lt;/td&gt;
  &lt;td&gt;&lt;%= question.question5 %&gt;&lt;/td&gt;
  &lt;td&gt;&lt;%= link_to 'Show', job_question_path(@job, question) %&gt;&lt;/td&gt;
&lt;/tr&gt;


&lt;% end %>

Questions Controller

def index
 @questions = Question.all

 respond_to do |format|
  format.html # index.html.erb
  format.xml  { render :xml =&gt; @questions }
 end
end

def show
  @job = Job.find(params[:job_id])
  @question = @job.questions.find(params[:id])

 respond_to do |format|
  format.html # show.html.erb
  format.xml  { render :xml =&gt; @question }
 end
end


Models

class Job &lt; ActiveRecord::Base
 has_many :questions

class Question &lt; ActiveRecord::Base
  belongs_to :job


Routes.rb

 root :to =&gt; "pages#home"

 resources :jobs do
  resources :questions
 end

 get "pages/home"
 get "pages/about"
 get "pages/contact"


See this https://gist.github.com/1032734 for my rake routes. 

Thanks for any help in advance, i've been at this for a while now and just can't figure out the solution. Please let me know if you need any more info. 


Question: Cannot shutdown Tomcat - transport Error
Answer: This problem appears to be because port-specific options (typically for debugging purposes) should be specified in CATALINA_OPTS instead of JAVA_OPTS. On shutdown, any port options in JAVA_OPTS will apply to the shutdown JVM, hence the "address already in use" error and shutdown failing. Please see http://stackoverflow.com/a/8216921/571357 - Jaan has provided a more complete answer.