I am new to Rails 3.1 and recently started a project. My gemfile contains jquery-rails:
gem 'jquery-rails'
And indeed, I have confirmed that it is present (version 1.0.19) in my current gemset RVM (using gem list ).
I started getting forms with Ajax support and, reading various articles and posts from Googling, it seems that I should have a file called rails.js in my javascripts folder (I assume these are assets/javascripts/ and I use the asset pipeline for default).
My question actually includes two parts:
I could not find the rails.js file in my project even after bundle install , so I downloaded it from https://github.com/rails/jquery-ujs and put it in my assets/javascripts/ folder. Is this the right thing?
After enabling rails.js my Ajax form now submits three times. Upon further investigation, it seems that all my javascript (or jquery ???) get three times. When I click the destroy link for an object (the type generated by rails g scaffold something ), a confirmation pop-up window also appears three times. Removing the rails.js file also fixes this problem.
Any help or advice would be much appreciated ... I searched around Google and SO for many hours and havenβt gone anywhere. Thanks!
source share