# Rjs ruby

**URL:** <https://www.ruby-forum.com/t/rjs-ruby/70198>\
**Category:** Rails\
**Created:** [September 27, 2006, 2:11pm UTC](https://www.ruby-forum.com/t/rjs-ruby/70198 "2006-09-27T14:11:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![harper](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b5ac83/32.png) [@harper](https://www.ruby-forum.com/u/harper)\
**Post date:** [September 27, 2006, 2:11pm UTC](https://www.ruby-forum.com/t/rjs-ruby/70198/1 "2006-09-27T14:11:49Z")

</div>

Is it Possible to write pure ruby code in rjs templates?  
something like

…rjs stuff  
if apple != oranges  
…rjs stuff  
else  
…rjs stuff

or am i totaly off the track?  
thanks in advance,

harp

---

<div class="post-metadata">

**Author:** ![harper](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b5ac83/32.png) [@harper](https://www.ruby-forum.com/u/harper)\
**Post date:** [September 27, 2006, 2:23pm UTC](https://www.ruby-forum.com/t/rjs-ruby/70198/2 "2006-09-27T14:23:36Z")

</div>

Yes.

c.

harper wrote:

> Is it Possible to write pure ruby code in rjs templates?  
> something like
> 
> …rjs stuff  
> if apple != oranges  
> …rjs stuff  
> else  
> …rjs stuff
> 
> or am i totaly off the track?  
> thanks in advance,
> 
> harp

---

<div class="post-metadata">

**Author:** ![harper](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b5ac83/32.png) [@harper](https://www.ruby-forum.com/u/harper)\
**Post date:** [September 27, 2006, 3:45pm UTC](https://www.ruby-forum.com/t/rjs-ruby/70198/3 "2006-09-27T15:45:54Z")

</div>

Yes for the “am i off track?” or Yes for the “Is it possible to…”

?

harp

Cayce B. wrote:

> Yes.

---

<div class="post-metadata">

**Author:** ![harper](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b5ac83/32.png) [@harper](https://www.ruby-forum.com/u/harper)\
**Post date:** [September 27, 2006, 4:26pm UTC](https://www.ruby-forum.com/t/rjs-ruby/70198/4 "2006-09-27T16:26:02Z")

</div>

LOL - sorry, your last “am I off track?” comment just didn’t register  
when I read the post.

Yes, the RJS template is pure ruby and you can include additional ruby  
code in it. Keep in mind you can run RJS commands at the page object  
inline from your controller, as well as from a separate .rjs template,  
so yes it is pure ruby.

I can’t recommend the Fauser .pdf download at  
[http://www.oreilly.com/catalog/rjsrails/](http://www.oreilly.com/catalog/rjsrails/) enough to folks starting with  
RJS - it will enlighten you with all things RJS. Way worth the $10.

c.

harper wrote:

> Yes for the “am i off track?” or Yes for the “Is it possible to…”
> 
> ?
> 
> harp
> 
> Cayce B. wrote:
> 
> > Yes.
