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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:34:37+00:00 2026-06-08T22:34:37+00:00

Context I have a Rails 3 app I’m working on and have the ‘jquery-rails’

  • 0

Context

I have a Rails 3 app I’m working on and have the ‘jquery-rails’ gem installed and

//= require jquery
//= require jquery_ujs
//= require_tree .

in my app/assets/javascripts/application.js file.

Alerts and coffeescript work ok IF they are base level items.

I’ve put them into app/assets/javascripts/application.js directly, app/assets/javascripts/pages.js and tried it as a coffeescript version in app/assets/javascripts/pages.js.coffee (just changed the file name)

As soon as I put them in something like:

$(document).ready(function(){
alert('works');
});

or (for coffeescript)

jQuery ->
  alert "hi"

It will not fire at all.

I’ve also tried including the jquery file in the application layout but same problems.

Question

Is there a different syntax for declaring jQuery functions within rails?
Does anyone have any ideas what could be going wrong?

Any help is appreciated. Thanks!

  • 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-08T22:34:39+00:00Added an answer on June 8, 2026 at 10:34 pm

    I think coffee script does not work because it should be in file with appropriate extension.

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

Sidebar

Related Questions

I have a rails app that is working fine except for one thing. When
I have a Ruby on Rails app that I'm working on and I'm having
We have the rails app, content served from the database. Now we need to
I have a prototype question in the context of Ruby on Rails. QUESTION -
I have a jruby/rails app using: jruby 1.4.0 Rails 2.3.5 ActiveMQ 5.3.0 Mule ESB
I have a Rails app that uses Cloudfront as its CDN and sprockets to
We have a Rails app that has some pages that are available to all
My Rails app is hosted on Heroku. I would like to have another server
I'm trying to create a Rails app template I have this block of code
Am planning on using declarative authorization in a Rails 3 app. I have the

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.