Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7753839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:09:14+00:00 2026-06-01T12:09:14+00:00

When I try to go to this url: http://localhost:3000/lessons/18/pages , I get this error:

  • 0

When I try to go to this url: http://localhost:3000/lessons/18/pages, I get this error:

No route matches {:action=>"show", :controller=>"pages", :lesson_id=>#<Page id: 5,
title: "Page One", page_num: 1, lesson_id: 18, stats_id: nil, sources_id: nil,
created_at: "2012-04-06 04:55:39", updated_at: "2012-04-06 04:55:39">}

I have two tables: lessons, pages

page.rb

belongs_to :lessons

lessons.rb

has_many :pages

routes.rb

resources :lessons do
   resources :pages
end

The pages index looks like this:

<% @lesson.pages.each do |page| %>
 <tr>
  <td><%= page.title %></td>
  <td><%= page.page_num %></td>
  <td><%= page.lesson_id %></td>
  <td><%= page.stats_id %></td>
  <td><%= page.sources_id %></td>
  <td><%= link_to 'Show', lesson_page_path(page) %></td>
  <td><%= link_to 'Edit', edit_page_path(page) %></td>
  <td><%= link_to 'Destroy', lesson_page, confirm: 'Are you sure?', method: :delete %></td>
 </tr>
<% end %>

And here is the pages controller:

def index
 @lesson = Lesson.find(params[:lesson_id])
    respond_to do |format|
    format.html # index.html.erb
    format.json { render json: @pages }
  end
end

Why is the show route not working?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T12:09:15+00:00Added an answer on June 1, 2026 at 12:09 pm

    With nested resource routes you need to pass all the objects in the route:

    lesson_page_path(@lesson, page)
    

    The error is somewhat revealing of this in that it shows that it’s trying to get the :lesson_id from a Page instance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to get string from this url: http://autoc.finance.yahoo.com/autoc?query=google&callback=YAHOO.Finance.SymbolSuggest.ssCallback When I look at this
I try to get this following url using the downloadURL function as follows: http://www.ncbi.nlm.nih.gov/nuccore/27884304
I have this url in my login page: http://localhost:5550/login?ReturnUrl=/forum/456 I have this controller: [HttpPost]
I have this mootools request: new Request({ url: 'http://localhost:8080/list', method: 'get', }).send(); and a
Symfony2 returns No route found for GET / when I try to run http://localhost/app_dev.php
I am doing an http get using the url http://localhost/add?add_key[0][key]=1234&add_key[0][id]=1. I have a rails
I've written this code to try and send a url as a post value
Here I am trying to route a page without showing its action in URL,
I'm trying to do an ajax request to get the contents of http://localhost/ running
please try this link for getting my code. its working in all browsers not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.