Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Switching from prototype to jquery in Rails, what about helpers?

I currently switching from prototype to jquery mainly to support simple ajax file upload. I use : https://github.com/indirect/jquery-rails

95% of javascript code is made by rails helper such as :

- remote_function
- render :update do |page|
- page.replace_html 'id', :partial => 'content'
- page['form']['name'] = something
- page.visual_effect :highlight, 'head_success'
...

I understand that the 5% of code purely prototype I have to rewrite it for Jquery, but what about the rest ? Do I have to rewrite it all in raw jquery ?

I use :

  • Rails 3.0.7
  • jquery-rails 1.0.7
like image 212
Hartator Avatar asked May 25 '11 14:05

Hartator


1 Answers

all that helpers are deprecated in favor of unobtrusive javascript (it doesn't matter if you're using jQuery or PrototypeJS).

you can find a detailed guide here:

http://www.simonecarletti.com/blog/2010/06/unobtrusive-javascript-in-rails-3/

like image 132
Andrea Pavoni Avatar answered Nov 12 '22 00:11

Andrea Pavoni