Give up RJS and go pure

Posted by Dr Nic on November 17, 2006 and blessed with 8 comments

RJS seems like a nice idea. Its Ruby with embedded Javascript.

Now put away the crayons and get back to pure Javascript with embedded Ruby with “MinusR” – RJS minus the R (for Ruby).

This is especially useful if you want a clean way to support non-Prototype/Scriptaculous frameworks, like jQuery. You can call the raw Javascript for these libraries, and embed your Ruby objects using Erb and a handy js helper to convert Ruby to JSON.

Its clean, healthy fun. Like carrots.

Makes me think about jogging, its just that healthy for you.

Related posts:

  1. Autotesting Javascript in Rails I used to love Javascript so much that it would...
  2. Supporting JSON callbacks in Rails Now you know how to write JavaScript widgets, now you...
  3. Extend Prototype $() yourself If you’re using the prototype javascript library, its fun to...
  4. Ajax on Rails – Prototype vs JQuery [Original article published on DevLounge - please post comments there]...
Trackbacks

Use this link to trackback from your own site.

Comments

Leave a response

  1. Chris Fri, 17 Nov 2006 21:24:45 UTC

    I’m in.

  2. Rodney Sat, 18 Nov 2006 15:00:53 UTC

    Most of the time rjs just confuses me. This has my vote. Much directer/clearer.

  3. Dr Nic Sat, 18 Nov 2006 15:39:16 UTC

    Yeah, I just found RJS was a 3rd programming language of sorts. I knew Ruby, I knew Javascript, and now I needed to know RJS. If you’ve got to look up the Prototype/Scriptaculous libraries anyway to know what you can do and want classes/methods to call, may as well express it in JS.

    I might change my mind in time, but I think I’ll use MinusR for awhile.

  4. zerohalo Sat, 18 Nov 2006 18:01:15 UTC

    Is it possible to give an example?

  5. zerohalo Sat, 18 Nov 2006 21:27:10 UTC

    Sorry, never mind, found it on Dan’s site.

  6. [...] (Found via Dr. Nic Williams) [...]

  7. Richard White Fri, 24 Nov 2006 14:23:53 UTC

    I very much agree. Hmmm should AjaxScaffold move to use MinusR instead or would that just be a maintenance nightmare?

  8. Dr Nic Fri, 24 Nov 2006 14:31:42 UTC

    @richard – pragmatically – if its already working now, I don’t see significant benefits. Plus, for AjaxScaffold – a generator – there aren’t enough unit tests (last time I looked) to let you refactor with confidence.

Comments