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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:59:33+00:00 2026-05-26T08:59:33+00:00

I am trying to put a nested form into one of my views. I

  • 0

I am trying to put a nested form into one of my views. I have installed the nested_form Gem and performed the installation steps. The last thing I did was edit my app/view/layouts/application.html.erb file to include this line

<%= javascript_include_tag "nested_form" %>

But when I look at the rendered page, the javascript doesn’t work. I examined the page source and saw that the rendered code for the nested_form javascript looks like this:

<script src="/assets/nested_form.js" type="text/javascript"></script>

So it appears to be looking in the wrong place. That .js file is located in public/javascripts, not in assets. Did I do something wrong or do I need to specify something else in that javascript_include_tag?

  • 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-26T08:59:34+00:00Added an answer on May 26, 2026 at 8:59 am

    From rails 3.1 and onwards, javascript_include_tag will only look in the asset pipeline for javascripts. If you want to add public/javascripts into your asset pipeline, simply add the public path to your

    Rails.application.config.assets.paths
    

    array when you initialize your RoR application, since defines the paths the asset pipeline looks at.

    So no you did not do anything wrong, the gem you are using is just outdated and it’s for rails 3.0-. Although I recommend try moving the javascripts from the public folder to the assets folder and see if it works, because that is the preferred way to put javascripts in a 3.1 application.

    Another way to solve your problem, though not recommended, is to disable the asset pipeline altogether, if you are not using it. This is done by removing

    config.assets.enabled = true
    

    in your config/application.rb

    If you want to know more about the asset pipeline, Railscasts has a video on it
    http://railscasts.com/episodes/279-understanding-the-asset-pipeline

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

Sidebar

Related Questions

I am trying to have a nested form on my users/new page, where it
I'm trying to use AVMutableComposition in a nested hierarchy. Therefor I have to put
I'm trying put an if statement directly into a select field in rails, with
I'm trying to put some custom list adapters into their own classes to make
I have kind of a tricky Oracle problem. I am trying to select one
Trying to perform a nested object form. The page loads with no errors, but
i am trying to use cocoon for nested ajax form coupled with formtastic my
I am trying to create form that contains another model in rails. I have
I seem to have two problems 1) While trying to update my singular nested
I have a build.xml to use with ant, and I'm trying to put a

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.