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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:38:15+00:00 2026-05-14T20:38:15+00:00

My current project requires me to assemble a .zip file containing HTML and text-only

  • 0

My current project requires me to assemble a .zip file containing HTML and text-only templates for a user to download, for importing into an email marketing program.

I’ve inherited this project, and currently the code uses a “fake” model (that is a model that does not directly correlate to a database table), in which it stores the entire template in a string, using dynamic variables to populate certain areas. The “fake” model then has a method for creating a zip file.

It seems to me that there has to be a better way to do this. I was wondering if there was a way to move the template into a .erb/haml file, and then write a method that would populate the file in preparation for being zipped up? Basically, is there a way to render an HTML and text file, without actually having to display them?

Thanks for any help.

  • 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-14T20:38:16+00:00Added an answer on May 14, 2026 at 8:38 pm

    Just write the action and view to render the html and text as normal then use the render_to_string method to assign the content to strings

    http://apidock.com/rails/ActionController/Base/render_to_string

    Then you can run the Model method (hopefully a Class method) to create the zip file using the content you now have in instance variables

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

Sidebar

Related Questions

My current project requires locating an array of strings within an element's text content,
I am working on a project that requires localization of all user-facing text in
My project runs on J2ME and requires me to get the user current street
One of the data structures in my current project requires that I store lists
A current jQuery project of mine requires browser resize (width AND height) functionality, some
My current project is broken down into 3 parts: Website, Desktop Client, and a
Our current project has ran into a circular dependency issue. Our business logic assembly
My current project requires extensive use of bit fields. I found a simple, functional
My current project has a small user base and nearly all clients will be
My current project requires a customized System date, which means a system date and

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.