Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jRails Alternative

do you know an alternative to jrails?

It's more or less outdated (uses jQuery 1.5 - now 1.7 is the current release).

Does anybody know an alternative?

Thanks

EDIT:

I know how to build the rails helper with jquery allone - but I like the rails helpers, so I dont want to use jquery allone (without jrails)

like image 331
BvuRVKyUVlViVIc7 Avatar asked Jul 28 '09 09:07

BvuRVKyUVlViVIc7


2 Answers

Having always used the Prototype helpers with Rails, I recently decided to move over to using JQuery. At first I looked at JRails, since it was a drop-in replacement and hence would require minimum effort.

BUT! After reading more about JQuery and playing around with it, it became apparent to me that the best way to use Rails and JQuery together is to handle it all yourself. This might sound like a more complicated, time consuming approach but it's honestly not! I see this approach as giving you two main benefits:

  • All your Javascript can be unobtrusive -- this won't be the case with JRails
  • You can use JQuery in .js.erb templates rather than using RJS templates, which gives you much finer control and is easier for front-end designers who are familiar with JQuery to get to grips with (the indirection of RJS, with it's Page object, is often confusing)

So, I recommend the first thing you do is watch the excellent JQuery Railscasts: http://railscasts.com/episodes/136-jquery. It's only a few minutes long and you'll be amazed at how easy and elegant it is to write AJAX code using JQuery and Rails.

You'll obviously need to get up to speed with JQuery too, but there are many excellent resources out there for this. JQuery is such an desirable skill these days, you'll be really thankful you took this approach.

like image 170
Olly Avatar answered Oct 03 '22 09:10

Olly


Right now there's no real alternative. However, you can install jRails then upgrade the jQuery installation simply replacing the javascript files (except jrails.js) in the javascripts folder.

The only issue I'm aware of about jRails is that current version isn't compatible with Ruby 1.9.

like image 41
Simone Carletti Avatar answered Oct 03 '22 08:10

Simone Carletti