RoR is shipped with Prototype javascript library, it's pretty rich in feature and when its combine with scriptaculous it brings awesome javascript effects to your rails app.
Having use both prototype and jquery, i find jquery little less verbose.
After all, write less and do more should be given more preference.
Here are steps to replace prototype with jquery using a gem christened 'jquery-rails' .
In your GemFile add this one more gem
gem 'jquery-rails'
once done adding, run your rails 3 bundler
$ bundle install
Confirm installation of jquery-rails gem:
$ gem list
# if you find 'jquery-rails' in the this list, you're good to go ,otherwise, confirm gemfile content.
Now, install jquery
$ rails generate jquery:install
# g is short tag for generate
sahilsk@dragonaider:~/cronfarm$ rails g jquery:install
/home/sahilsk/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.6/lib/rails/script_rails_loader.rb:11: warning: Insecure world writable dir /home/sahilsk in PATH, mode 040777
/home/sahilsk/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.12/lib/bundler/runtime.rb:136: warning: Insecure world writable dir /home/sahilsk in PATH, mode 040777
remove public/javascripts/controls.js
remove public/javascripts/dragdrop.js
remove public/javascripts/effects.js
remove public/javascripts/prototype.js
fetching jQuery (1.5)
identical public/javascripts/jquery.js
identical public/javascripts/jquery.min.js
fetching jQuery UJS adapter (github HEAD)
conflict public/javascripts/rails.js
Overwrite /home/sahilsk/cronfarm/public/javascripts/rails.js? (enter "h" for help) [Ynaqdh] Y
force public/javascripts/rails.js
Be sure to override rails.js file insiide /public/javascript/ folder.
Having use both prototype and jquery, i find jquery little less verbose.
After all, write less and do more should be given more preference.
Here are steps to replace prototype with jquery using a gem christened 'jquery-rails' .
In your GemFile add this one more gem
gem 'jquery-rails'
once done adding, run your rails 3 bundler
$ bundle install
Confirm installation of jquery-rails gem:
$ gem list
# if you find 'jquery-rails' in the this list, you're good to go ,otherwise, confirm gemfile content.
Now, install jquery
$ rails generate jquery:install
# g is short tag for generate
sahilsk@dragonaider:~/cronfarm$ rails g jquery:install
/home/sahilsk/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.6/lib/rails/script_rails_loader.rb:11: warning: Insecure world writable dir /home/sahilsk in PATH, mode 040777
/home/sahilsk/.rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.12/lib/bundler/runtime.rb:136: warning: Insecure world writable dir /home/sahilsk in PATH, mode 040777
remove public/javascripts/controls.js
remove public/javascripts/dragdrop.js
remove public/javascripts/effects.js
remove public/javascripts/prototype.js
fetching jQuery (1.5)
identical public/javascripts/jquery.js
identical public/javascripts/jquery.min.js
fetching jQuery UJS adapter (github HEAD)
conflict public/javascripts/rails.js
Overwrite /home/sahilsk/cronfarm/public/javascripts/rails.js? (enter "h" for help) [Ynaqdh] Y
force public/javascripts/rails.js
Be sure to override rails.js file insiide /public/javascript/ folder.
No comments:
Post a Comment