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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:50:03+00:00 2026-05-28T15:50:03+00:00

Big Update : As I finally found the real solution, I also discovered the

  • 0

Big Update:

As I finally found the real solution, I also discovered the real problem. As I wrote down here a lot of useless information, considering the real problem, I’m making a huge update of the question so that other people can find easily what’s going on and can see the solution.

The Problem:
It’s because of the assets pipeline of Rails 3.1

Actually… It’s an easy one: the assets were rendered twice in development-environment. Doing lot of investigations shew me that my Rails 3.1 server was rendering the assets from both the “app/assets” and “public/assets” folders. So, I had every .js and .css files duplicated, which was breaking all my javascript animations (yeah… binding twice the same event and handler to the same element is not what you want… normally).

And if the problem appeared all of a sudden, that was because I had to run “rake assets:precompile” to deploy my application. Since that, when my application was running in development, the server was rendering the static precompiled assets and the dynamic precompiled assets.

The solution (there’s now a better one few lines below) – but you can still read it

First one: I just had to delete all the precompiled assets from my public folder.

Better one: Add config.serve_static_assets = false to development.rb which will prevent loading files from /public/assets. Also, don’t forget to reset your browser cache.

[Edit: July 20th 2012]

Advanced one: I recently had a new problem because of those static assets. You know, when you use paperclip or some other gem and they add your images in your public folder in some system sub-folder because it’s better if you want to deploy your application using capistrano. Well, that’s great but! As we added config.serve_static_assets=false, those images aren’t rendered in development and that’s bad if you want to do some css on them. So! What to do then?

Well in fact you’ll have to turn on static assets in development like so:

# Expands the lines which load the assets
config.assets.debug = true
config.serve_static_assets = true

Then to prevent rails from rendering your other assets twice (the precompiled ones), just do this command:

rake assets:clean

It’s the opposite of rake assets:precompile and will clean your public/assets folder so that Rails won’t render your assets twice. Of course you’ll still have to clean your browser cache and clean your assets each time you precompiled them.

[Edit: November 18th 2013] – From @idejuan answer

Another solution:

You can add this line:

config.assets.prefix = '/dev/assets'

To development.rb, where the prefix can be whatever you want. Scripts will not load twice anymore, and images in /public/system will be read! But be carefull as it changes the path to your “static” assets… if you require assets from a gem, it might not load them properly in development…

[End edit]

The remaining question with answer!

Well, why my development application was rendering static precompiled assets?

In fact if you precompile your assets localy, rails render assets from the public folder AND from the assets folder in development and test environment by default. Normally assets from the public folder should overwrite those from the assets folder, but it’s not the case and even if it does, we would lost the benefits of the “debug_mode” as we would have to precompile assets each time. So… Assets are rendered twice when precompiled locally in development and test environment.

So, by adding “config.serve_static_assets = false” to your development.rb file, you somehow overwrite the default line that telling Rails to look in your public folder for assets. I hope they’ll do something cleaner one day about locally precompiled assets.

Thanks to the ones who helped me for my investigations :).

Kulgar.

  • 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-28T15:50:03+00:00Added an answer on May 28, 2026 at 3:50 pm

    You might want to look at

    https://stackoverflow.com/a/7854902/686460

    “Adding config.serve_static_assets = false to development.rb will prevent loading files from /public/assets”

    I think that is a better solution than what you are suggesting here.

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

Sidebar

Related Questions

I have a big problem with JTable . Here is how it works: a
Big problem. I'm not sure what it was that I did, but it seems
It's big problem to convert mod_rewrite rules to lighttpd format
I am a new to db4o. I have a big problem with persistance of
I recently did a big update on my wordpress site, thus some old permalink
I'm using Postgres and would like to make a big update query that would
I used the code described here to update an excel sheet using c#. The
BIG UPDATE: Ok I was getting the whole auto-increment point wrong. I though this
I have to do a big update script - not an SPL (stored procedure).
<< Big update below implies it's simply a logging issue >> I'm trying to

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.