Strange Routing Error

I have set up nested routing for a project I’m working on. The routing
config file looks like this:

resources :projects do
resources :key_questions
end

I have this working for other aspects of my site just fine, and
actually have no problems at all except for when I’m trying to destroy
a key_question entry.

Here is my destroy method of the key_questions controller:
def destroy
@key_question = KeyQuestion.find(params[:id])
@key_question.destroy

respond_to do |format|
  format.html

{ redirect_to( project_key_questions_path(session[:project_id]) )}
format.xml { head :ok }
end
end

I use the same redirection for other links on the site and they work
fine, but when calling the destroy action I get the error:
No route matches “/projects/53/key_questions”

If I then move my cursor to the URL bar and push enter, it loads that
same page just fine without a routing error. What is going on here???
I should also note that the database entry is not being removed.

My Config:
Rails 3.0, Ruby 1.9.2

Thank you so much to anyone who can offer some advice!

  • Chris

Please disregard this question, I figured it out. The error message was
giving me very little information, so I incorrectly thought the issue
was in
the controller when it was in the view and was simple to fix once I
figured
out where it was.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs