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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:43:48+00:00 2026-05-20T14:43:48+00:00

Ok, I thought I knew what I was doing and am instead immensely confused

  • 0

Ok, I thought I knew what I was doing and am instead immensely confused by the vast amount of conflicting resources on the internet.

I have a rails 3 app. I want to take prototype out of this app completely and ONLY use jQuery. Some of this code is in rjs files, but most of it is in format.js{} methods in the project controllers.

I found this railscast, which makes it seem like I can do the following for any given action:

def action_name
    #do stuff
    respond_to do |format|
        format.js
        #format other types
    end
end

and then put my jquery code that I want to execute in a file called action_name.js.erb.

BUT I tried doing this AFTER removing prototype from my application (changing my rails.js file to jquery, and not including the prototype.js in my page header), and I got this error:

 RJS error:

 TypeError: $ is not a function

Why is it trying to call rjs and not recognizing my jquery? am I supposed to use rjs templates instead of .js.erb files? I thought I removed prototype from my application – did I miss something?

Most of all, is there a DEFINITIVE way to do this conversion from Prototype to jQuery that is up to date for Rails 3 as of February 2011? I’m so confused on the best way to do this, and what I should be using (rjs files or js.erb files).

Thanks so much and I can edit in more info if needed.

  • 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-20T14:43:49+00:00Added an answer on May 20, 2026 at 2:43 pm

    as for rails 3
    as you did:
    install the unobtrusive jquery adaptor enough in development environment since this is used only to install and remove js files

    gem "jquery-rails"
    

    then after bundlde install run

    bundlde install
    rails generate jquery:install #--ui to enable jQuery UI --version to install specific version of JQuery (default is 1.5)
    

    this takes care of the jquery code that ahook on data- html5 tags unobtrusively such as remote ajax
    requests or remote submits.

    in order to use rjs, the defult prototype helpers should be redefined to emit jquery code
    to do this, use the jrails gem

    gem 'jrails', :git => 'https://github.com/theworkinggroup/jrails.git'
    

    this takes care of old prototype functions like observe form, dom insertion and replacement methods etc.

    with this you can continue using your rjs temlates or write inline js with render :update

    probably because of the limitations of rjs (sophisticated js should still be written as strings to the page resopnse), people prefer js.erb although it is the two ugliest code formats on earth put together, jeez

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

Sidebar

Related Questions

some comments here have confused me! I thought I knew this and god knows
Sorry to ask this as I thought I knew the answer, I want to
I have a problem that I thought I knew how I can fix, but
A large amount of what I thought I knew about REST is apparently wrong
I thought I knew this, but am confused :( Need some clarification on it
I thought I'd find more about this topic but I didn't. I have to
So, I thought I knew my basic CSS, but my brain is twisting right
I always thought I knew C very well until I saw something like this
I thought I knew everything about UDTs and JDBC until someone on SO pointed
So.. I thought I knew mssql fairly well but this one query asked of

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.