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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:16:28+00:00 2026-05-30T02:16:28+00:00

I have some template files I would like to use in my rails App.

  • 0

I have some template files I would like to use in my rails App. I was wondering where(under which directory) to put them given two scenarios:

  1. They are private to my application (Only webmaster can delete, change them)
  2. They are private to my application but also they can be managed by admins(deleted, modified)
  • 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-30T02:16:30+00:00Added an answer on May 30, 2026 at 2:16 am

    Update after comments

    Since you want to serve the files locally, just put them outside of the /public/ folder and outside of any of the /assets/ folders and you should be good. You can read more about the public and assets folders here: Section 2 How to use the Asset Pipeline Let’s say:

    /private/
    

    I believe Section 11 send_file also used in the SO question linked in my original answer below is still the way for you to provide access to files through a controller rather than statically. Adapted from the docs:

    send_file("#{Rails.root}/private/#{filename}",
              :filename => "#{filename}",
              :type => "application/pdf", #for example if pdf
              :disposition => 'inline') #send inline instead of attachment
    

    Original answer for remote serving together with send_file below

    Regarding 1) files private to the application
    You can lock up these private files in a system like Amazon S3 that provides authorized access as Callmeed explains in this SO question. Then only your application will be able to authorize access to a file.

    Regarding 2) also accessible to admins

    The problem with just using part 1) is that it unlocks the files for a limited time period during which I assume they are publicly available. So if you want to get around that, I think you need to take the solution from Pavel Shved actually in the same SO question above.

    In that solution, files are provided through a route/controller that provides the binary data of the file rather than using a URL that points to the file.

    Combined solution

    Read the file from S3 with only your application authorized to do that access (not opening it publicly). Then provide the data directly through the controller which can authorize whomever you want.

    Caveats

    • Providing binary data directly from the controller seems like it would kill performance of the
      application if it is used often, but I’ve never tried it.
    • If you can find a more simple way to do part 1), part 2) will still work with that solution
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some css files that i need to use in RTL direction template.
In my rails model I have some kind of template system. I want to
I have a big chunk of HTML which is a template for some data
I have a custom dependency property that I would like to use as a
I have an outlook automation. I would like to use a Word document as
I'm using jQuery in my current Rails project and I'd like to have some
I have a project with some folders which happen to contain source files with
I have an XML Template file. This file contains a header and some predefined
Let's say I have some Jinja2 template with several blocks in it: {% block
Is it possible to have some sort of template where a certain column (lets

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.