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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:53:13+00:00 2026-06-07T17:53:13+00:00

I have created an html file by using render_to_string in a controller and send_data

  • 0

I have created an html file by using render_to_string in a controller and send_data to send the html file to the user. That works great and the file I get back matches the html I see when I right click and view page source in my browser. However, in my html file there are links to css files and .js files that don’t exist in my app/assets folder.

For example, there is a link to application.css in the html file but there is only application.css.scss in the app/assets folder. Or another example; lightbox.css.erb instead of lightbox.css.

Also, some of the paths in the html are wrong, for example images are located in app/assets/images, but the html is looking in app/assets. The pathing is not an issue since I can just edit the generated html with nokogiri, but I am curious as to why they are different.

This is pretty much exactly what I want to do rails: emulate "Save page as" behaviour

Except that I’m getting my html a different way and for whatever reason I can’t find the assets I’m looking for. The html appears valid as I indicated earlier, and opening the file will display text from the html but won’t display any images or assets until I change the link paths.

From what I’ve read, rails will transform scss to css and render erb files to js or html. I can’t find these files anywhere in my directories, though. How can I generate the files that I need in order to display my static html file independently from the rails app?

I’m using Rails 3.2.2 with jruby 1.6.7 (ruby 1.9.2)

  • 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-07T17:53:14+00:00Added an answer on June 7, 2026 at 5:53 pm

    Before a rails app is deployed to production mode, all of your assets (css, javascripts and images) are usually precompiled and placed in the public directory, which is where your rails-rendered html pages look for assets.

    In development mode, this precompilation is not usually done, but it can be done if desired. To generate the compiled assets, you can run rake assets:precompile. This will compile your assets, “fingerprint” them and place them in the public folder. “Fingerprint” means that it will generate a hash based on the file content of an asset and place the hash in the asset’s filename, which helps to determine if/when the content of the asset has changed just by reading the filename.

    After you run this command, you can copy or move the assets to a new directory (outside your rails app) where you can serve the html pages and these assets independently from the rails app. You might also delete the compiled assets from the public directory, since these aren’t generally very useful in development mode.

    For some background, I would read about the Asset Pipeline.

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

Sidebar

Related Questions

I have activated the IIS package for windows, and, I created an index.html file
I have an IntentService that is parsing some xlm file to create a html
I have created a html page in php and upon submission i validates that
I have created a basic shape in HTML canvas element which works fine. The
I have created a simple layout using the HTML div tag. I would like
I have created web pages where am using pixel to position various html elements.
I have been working on a project that dynamically creates a javascript file using
I have created an app that performs all CRUD operations remotely using Jquery. In
I have this code in a .html.erb file: <script src=http://connect.facebook.net/en_US/all.js#xfbml=1></script> <script> FB.Event.subscribe('edge.create', function(response) {
I have created a populated dropdown list in HTML. When the two dropdowns have

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.