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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:24:37+00:00 2026-06-04T06:24:37+00:00

In my Rails app, every page includes all of the JavaScripts in assets .

  • 0

In my Rails app, every page includes all of the JavaScripts in assets.

Some custom scripts are for Ajax and some fancy stuff. which run unnecessarily from every page and are causing me unnecessary overload.

For example, the session page doesn’t really need any JavaScript at all, still all scripts are included. How do I change this? I have Rails 3.2.2.

<script src="/assets/jquery-1.7.2.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery.ui.core.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery.ui.widget.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery.ui.position.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery.ui.autocomplete.js?body=1" type="text/javascript"></script>
<script src="/assets/special.js?body=1" type="text/javascript"></script>
  • 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-04T06:24:38+00:00Added an answer on June 4, 2026 at 6:24 am

    I use content_for.

    application.html.erb

    <head>
      <%= yield :custom_js %>
    </head>
    

    your_page.html.erb

    <% content_for :custom_js do %>
       <!-- your script includes go here -->
    <% end %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My Rails app has some pages which are SSL-required and others which are SSL-optional.
Every time I try to post to twitter in my rails app, the first
My rails app crashes as soon as I access a web page. My versions
I've got a Rails 3.2.1 app that I'm trying to include some jquery in.
I'm working on my first Rails app. It needs to store some information about
I've been trying to implement a commenting system for my Rails app. Every event
I have a rails app that is combining javascript assets using Jammit , and
In my rails app, I'm using the SendGrid parse API which posts mail to
I've got a Rails app where I need salaries to be paid every month
My Rails app needs to retrieve an updated count from the server every minute.

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.