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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:51:05+00:00 2026-06-10T01:51:05+00:00

I am writing query output to a CSV file in a folder called ‘reports_output’

  • 0

I am writing query output to a CSV file in a folder called ‘reports_output’ inside my ‘report_runs’ views folder. The file names need to be generated based upon the name given by users running reports and other parameters like current time etc. I have two issues:

  1. How to generate unique file names using Time.now converted to string of numbers (like version numbers in db/migrate) ? and
  2. How to do correct routing to all these .csv files?

I was able to write files with simple names e.g. Item_List.csv below, but not been able to view the files by clicking on the url to the file in my show view in browser. The error says :

No route matches "/report_runs/report_outputs/Item_List.csv"
  • 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-10T01:51:06+00:00Added an answer on June 10, 2026 at 1:51 am

    1: You can generate a filename that includes the current time using simple string interpolation and you can format the string with Time#strftime:

    file_name = "item_list#{Time.now.strftime('%Y%m%d%H%M%S')}.csv"
    

    2: If you want to serve static assets like your .csv files then you can write them to the public folder. So for example if you create a file in public/report_runs/report_outputs/Item_List.csv it will be accessible from the path given in your example.

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

Sidebar

Related Questions

I am writing an Android app and I need to download a csv file
I've been asked to output a CSV file from a view in MySQL. The
I need a little help writing a query. I have this data... vDir iNumber
I am writing an SQL query in which that I will need to perform
I have problem with writing csv file using fputcsv. Its putting the page html
I need help writing a T-SQL query that will generate 52 rows of data
I am writing a SQL query results to a file and once I am
I am having trouble writing query so that I can query the content of
When writing a query for paging on a web page what is the least
I'm writing this query and I'm running into a mental road block. I keep

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.