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

  • Home
  • SEARCH
  • 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 8964957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:42:20+00:00 2026-06-15T16:42:20+00:00

I am trying to download the data stored amazon s3 bucket using paperclip and

  • 0

I am trying to download the data stored amazon s3 bucket using paperclip and aws-sdk gem. Object is publicly accessible.

I am having a method in my controller where I intend do download the data directly.

def method_where_downloading_happens
  code for finding url from params
  send_file "ModelName.attached_file.url"
end

#Tried both with static and dynamic url.

I am getting following error

NoMethodError: undefined method `send_file for main:Object

However if I use :-

send_file open(ModelName.attached_file.url)

Then a file is downloaded but it’s format is binary i.e. windows can’t identify the file_type.

Please help how do I provide direct download when the person hits the link.

  • 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-15T16:42:22+00:00Added an answer on June 15, 2026 at 4:42 pm

    You can try this:

    #In your environment.rb require 'open-uri'
    require 'open-uri'
    
    #As send_data will work in controller, so in your controller
    def index
      data = open(params[:file])
      send_data data, :filename => params[:name], ...
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to download share data from a stock exchange using python. The problem
I'm trying to download data from my Google App Engine app, using the official
So I am trying to download and load an object from a file stored
I'm trying to download data using commands below. import urllib url = 'http://www.nse-india.com/content/historical/EQUITIES/2002/MAR/cm01MAR2002bhav.csv.zip' urllib.urlretrieve(url,
I'm trying to download some data using pure javascript/html from cross-domain, dropbox to be
I am trying to download a file from a website using python and mechanize.
I am trying to download a non-market application in Android using the DownloadManager class.
I am trying to download the contents of a website using wget tool. I
I am trying to download file using FTP, and in between if connection terminates
I am trying to download a set of .jpg's from Amazon S3 and store

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.