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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:22:11+00:00 2026-05-14T15:22:11+00:00

i have an RoR application Log, which similar to the book store app, my

  • 0

i have an RoR application Log, which similar to the book store app, my logs_controller has all default action: index, show, update, create, delete..

now i need to add new action :toCSV, i defined it in logs_controller, and add new route in the config/routes as:

map.resources :logs, :collection => { :toCSV => :get }.

from irb, i checked the routes and see the new routes added already:

>> rs = ActionController::Routing::Routes
>> puts rs.routes
GET    /logs/toCSV(.:format)?                   {:controller=>"logs", :action=>"toCSV"}

then ran ‘rake routes’ command in shell, it returned:

toCSV_logs GET    /logs/toCSV(.:format)         {:controller=>"logs", :action=>"toCSV"}

everything seems working. finally in my views code, i added the following:

link_to 'Export to CSV', toCSV_logs_path

when access it in the brower ‘http://localhost:3000/logs/toCSV‘, it complained:
Couldn’t find Log with ID=toCSV

i checked in script/server, and saw this one:

ActiveRecord::RecordNotFound (Couldn't find Log with ID=toCSV):
  app/controllers/logs_controller.rb:290:in `show'

seems when i click that link, it direct it to the action ‘show’ instead of ‘toCSV’, thus it took ‘toCSV’ as an id…anyone know why would this happen? and to fix it? Thanks…

  • 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-14T15:22:12+00:00Added an answer on May 14, 2026 at 3:22 pm

    This can be a workaround:
    Create a named resource:

    map.toCSV 'logs\toCSV', :controller => :logs, :action => :toCSV

    I am really sorry i forgot to mention the main point!

    In your view it should be:

    link_to 'Export to CSV', toCSV_path

    Also, these named routes come in handy especially when you have authentication involved. For instance, during signup, rather than directing the user to \user\new you can direct him to \signup. Its more friendly.

    Thats it!!

    Its simpler and it works. Cheers! 🙂

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

Sidebar

Related Questions

I have a basic question. I already have a RoR application which has hundreds
I have a RoR application running on box1...it obviously has Ruby, RubyGems, and Rails
I currently have an RoR app in production across four application servers with independent
I have RoR 3.0 web application which is acting as an OAuth API provider.
I have a RoR 2.3.8 application running on EC2, I am using engineyard. which
Background I have a ror application which is continuously recording and showing on a
I have an action in my RoR application, and it calls a different script
I have a RoR application (ruby v1.8.7; rails v2.3.5) that is caching a page
I have this RoR app that calls to RAILS_ROOT. When running it using rails
I have recently moved my RoR app on the Heroku platform, and almost everything

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.