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 8102877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:21:38+00:00 2026-06-05T23:21:38+00:00

I’m starting a new Rails 3.2.6 application. My nested route is failing when I

  • 0

I’m starting a new Rails 3.2.6 application. My nested route is failing when I attempt to view the new nested form. I’ll first show the error, then all of the code involved.

URL attempting to access: http://localhost:3000/reports/1/expenses/new

No route matches {:action=>"show", :controller=>"expenses", :report_id=>#<Report id: 1, name: "Test Report", created_at: "2012-06-07 21:58:37", updated_at: "2012-06-07 21:58:37">}

routes.rb

resources :reports do
  resources :expenses
end

expenses_controller.rb

def new
  @report = Report.find(params[:report_id])
  @expense = @report.expenses.new
end

views/expenses/new.html.haml

%h1 New Expense
= render 'form'

views/expenses/_form.html.haml

= form_for [@report, @expense] do |f|

This is the link I’m attempting to click:

= link_to 'New Expense', new_report_expense_path(@report)

I can’t figure out why it’s trying to access the show action when I’m explicitly calling the new action.

Rake Routes

report_expenses     GET    /reports/:report_id/expenses(.:format)          expenses#index
                    POST   /reports/:report_id/expenses(.:format)          expenses#create
new_report_expense  GET    /reports/:report_id/expenses/new(.:format)      expenses#new
edit_report_expense GET    /reports/:report_id/expenses/:id/edit(.:format) expenses#edit
report_expense      GET    /reports/:report_id/expenses/:id(.:format)      expenses#show
                    PUT    /reports/:report_id/expenses/:id(.:format)      expenses#update
                    DELETE /reports/:report_id/expenses/:id(.:format)      expenses#destroy
        reports     GET    /reports(.:format)                              reports#index
                    POST   /reports(.:format)                              reports#create
     new_report     GET    /reports/new(.:format)                          reports#new
    edit_report     GET    /reports/:id/edit(.:format)                     reports#edit
         report     GET    /reports/:id(.:format)                          reports#show
                    PUT    /reports/:id(.:format)                          reports#update
                    DELETE /reports/:id(.:format)                          reports#destroy
           root            /                                               reports#index

UPDATE
Link to GitHub repo: https://github.com/ardavis/expense_report

  • 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-05T23:21:41+00:00Added an answer on June 5, 2026 at 11:21 pm

    The error is in the views/expences/_form.html.haml, last line

          = link_to 'Cancel', report_expense_path(@report), class: 'btn'
    

    You probably meant

          = link_to 'Cancel', report_path(@report), class: 'btn'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I want to show the soap response to UIWebview.. my soap response is, <p><img
I have a text area in my form which accepts all possible characters from
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I have a view passing on information from a database: def serve_article(request, id): served_article
I'm making a simple page using Google Maps API 3. My first. One marker

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.