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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:46:37+00:00 2026-05-31T09:46:37+00:00

I seem to be getting a routing error within my Rails project each time

  • 0

I seem to be getting a routing error within my Rails project each time I try access the index for “Bank Accounts”. I’m quite new to Rails so this should probably be a simple error. If I’ve missed anything I apologise.

Errors I’m getting:

ActionController::RoutingError in Bank_accounts#index
Showing app/views/bank_accounts/index.html.erb where line #21 raised

This is the line of code that Rails doesn’t seem to like:

<td><%= link_to 'Transaction Details', bank_account_transaction_path(bank_account) %>  </td>

Routes file:

ActionController::Routing::Routes.draw do |map|
map.resources :bank_accounts, :has_many => [:transactions]

map.root :controller => "bank_accounts"

map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
end

Index view for Bank Accounts

<% @bank_accounts.each do |bank_account| %>
<tr>
<td><%=h bank_account.account_number %></td>
<td><%=h bank_account.holders_name %></td>
<td><%=h bank_account.overdraft_limit %></td>
<td><%=h bank_account.current_balance %></td>
<td><%=h bank_account.active %></td>
<td><%= link_to 'Show', bank_account %></td>
<td><%= link_to 'Edit', edit_bank_account_path(bank_account) %></td>
<td><%= link_to 'Transaction Details', bank_account_transaction_path(bank_account) %>      </td>
<td><%= link_to 'Destroy', bank_account, :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
  • 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-05-31T09:46:38+00:00Added an answer on May 31, 2026 at 9:46 am

    My understanding of the Rails naming convention is that if you want to link to an index of nested resources, you need to use the plural:

    bank_account_transactions_path(bank_account)
    

    And if you want to link to a particular nested resource, use the singular and pass in the nested resource ID as a second argument:

    bank_account_transaction_path(bank_account, txnid)
    

    And this question has an example of a cleaner syntax – you might like that better.

    hope that helps!

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

Sidebar

Related Questions

I seem to be getting run-time errors in my project when using javac for
I seem to be getting a strange error when I run my tests in
I seem to be getting a type mismatch error when trying to do something
I cannot seem to figure out I am getting the following error in IE
I'm getting the following error message and I can't seem to figure out the
This may seem like a simple question but i am getting an error when
Can I create Ruby classes within functions bodies ? I seem to be getting
I seem to be getting an error I can't really understand. Hopefully this doesn't
I seem to be getting a ')' Expected error when I am trying to
Probably what I'm asking is quite simple but I don't seem to be getting

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.