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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:51:03+00:00 2026-06-18T15:51:03+00:00

I have a method in a module which generates a csv file called to_csv.

  • 0

I have a method in a module which generates a csv file called to_csv.

My controller action:

def download_csv
    @rating = RatingSet.find(params[:rating_set_id])
    rating_id = @rating.id
     respond_to do |format|
                format.csv { send_data @rating.to_cvs(rating_id) }
  end
end

My route:

download_csv_co_view_rating_index GET  /co_view_rating/download_csv(.:format)     co_view_rating#download_csv

My view:

<small><%=link_to "Download CSV Data", :controller => "co_view_rating", :action => "download_csv", :rating_set_id => rating.id %></small>

When I click the link, the link will open:

co_view_rating/download_csv?rating_set_id=6

But nothing happens. What am I missing/doing wrong?

  • 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-18T15:51:05+00:00Added an answer on June 18, 2026 at 3:51 pm

    You need to pass the format type to your link_to helper:

    <%= link_to "Download CSV Data", url_path(:format => :csv), ... %>
    

    Update

    If you need to include the params as well then do:

    <%= link_to "Download CSV Data", url_path(params.merge(format: "csv")), ... %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in my self-defined module I have this method which will query the db and
I have method that returns module path of given class name def findModulePath(path, className):
For example, on Mage_Sales_Model_Order you have a method called sendNewOrderEmail() which runs this appEmulation,
I have the following method in a python module which takes all default arguments,
In python 2.5, I have the following code in a module called modtest.py: def
I have a search action method which accepts at this time 5 optional parameters
I have a method in a url rewriting module that looks like this public
I have this vendor-supplied TLB file, which I've used to generate a Ruby proxy
I have series of Toast messages in a module which displays a Toast each
I have a Telit module which runs [Python 1.5.2+] (http://www.roundsolutions.com/techdocs/python/Easy_Script_Python_r13.pdf)!. There are certain restrictions

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.