Forum: Ruby on Rails RJS - What the the advantages? / Why use?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Greg H. (Guest)
on 2007-01-16 23:47
(Received via mailing list)
Hi,

I've read up on RJS and understand the concept/how-to-use.   It's still
not
clear in my mind when and why to use RJS?  Can anyone drop in a couple
of
bullet points re advantages + when/why would RJS make sense?

Thanks
koloa (Guest)
on 2007-01-17 00:17
RJS makes javascript easy. purchase the 6 dollar tutorial on RJS by
orielly. after building the sample application, you will definitly see
the benefit vs trying to use ajax.


Greg H. wrote:
> Hi,
>
> I've read up on RJS and understand the concept/how-to-use.   It's still
> not
> clear in my mind when and why to use RJS?  Can anyone drop in a couple
> of
> bullet points re advantages + when/why would RJS make sense?
>
> Thanks
Philip H. (Guest)
on 2007-01-17 01:55
(Received via mailing list)
> I've read up on RJS and understand the concept/how-to-use.   It's still not
> clear in my mind when and why to use RJS?  Can anyone drop in a couple of
> bullet points re advantages + when/why would RJS make sense?

Not really a bullet point, but RJS/ajax makes building a "video player"
extremely easy and very friendly... for my player I have a list of
channels, a playlist, and the video itself.

Click a channel and the only thing that updates is the playlist/video.
Click on an entry in the playlist, only the video updates.
Click the "next page" link in the playlist, and the playlist updates and
the video...

Click the "add to favorites" and the only thing that updates is that
link
with a message that now reads "remove from favorites".

Basically it stops me from having to refresh the entire page for every
action...

-philip
Greg H. (Guest)
on 2007-01-17 05:11
(Received via mailing list)
Tks - so from the point of ease in coding javascript there is an
advantageous.  What about from a design/architecture/performance
perspective?

Note I'm asking about the RJS templates concept, not about AJAX (i.e.
one
could I assume build an AJAX type feature with or without RJS).
Phlip (Guest)
on 2007-01-17 05:45
(Received via mailing list)
Greg H. wrote:

> Tks - so from the point of ease in coding javascript there is an
> advantageous.  What about from a design/architecture/performance
> perspective?

Most applications are multilingual, so most applications should put as
much
code as possible in one language. Ruby makes "Domain Specific Languages"
spectacularily easy, so you should only write raw SQL if you can't find
an
ActiveRecord way to do things, and you should only write raw JavaScript
if
you can't find an RJS way to do things.

The advantage is you can refactor freely, and improve your design,
architectures, and development speed, by putting code together by the
affinity of its concepts, not by what language it happens to be in.

Curiously, I prefer Builder::XmlMarkup over the raw HTML in rhtml files.
But
HTML is special where we must preserve compatibility with graphic
designers...

--
  Phlip
  http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
This topic is locked and can not be replied to.