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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:46:12+00:00 2026-05-30T09:46:12+00:00

I’ve got a Rails 3.2.1 app that I’m trying to include some jquery in.

  • 0

I’ve got a Rails 3.2.1 app that I’m trying to include some jquery in.

Here are the files:

states.js:

var grid;

var columns = [
 {id: "firstName", name: "FirstName", field: "FirstName"},
 {id: "lastName", name: "LastName", field: "LastName"}
]



var options = {
 enableCellNavigation: true,
 enableColumnReorder: false
};

$(function () {
 alert("hi");
 var state = $("#myGrid").data("state");
 $.getJSON(state, function(data){
    grid = new Slick.Grid("#myGrid", data, columns, options);
});
})

states_controller.rb:

class StatesController < ApplicationController
def index
  @states = SiteIndexPlayer.select("DISTINCT HometownState")
end

def name
  logger.debug(":name #{params[:name]}")
  @athletes = SiteIndexPlayer.select('FirstName, LastName').find_all_by_HometownState(params[:name])
  @state=params[:name]
  respond_to do |format|
    format.html
    format.json { render json: @athletes }
  end
end
end

I’m getting the "hi" popup twice on every page load.

Are there 2 requests going out for some reason?

Thanks

Problem

Turns out states.js is being loaded to the DOM twice. I’m not precompiling the assets. Any other ideas why the file is getting loaded twice?

Solution

ls app/assets/javascripts
application.js  lib     slick.core.js   slick.grid.js states.js.coffee  states.js 

I’m guessing the states.js.coffee was loading the file as well as application.js. As soon as I removed states.js.coffee, it worked fine.

Know where I might read up on *.coffee?

Edit

application.js:

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require_tree .

application.html.erb

<!DOCTYPE html>
<html>
<head>
  <title>CapApp</title>
  <%= stylesheet_link_tag    "application", :media => "all" %>
  <%= javascript_include_tag "application" %>
  <%= csrf_meta_tags %>
</head>
<body>

<%= yield %>

</body>
</html>
  • 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-30T09:46:13+00:00Added an answer on May 30, 2026 at 9:46 am

    I’m guessing the states.js.coffee was loading the file as well as application.js. As soon as I removed states.js.coffee, it worked fine.

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

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is

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.