# RJS Help

**URL:** <https://www.ruby-forum.com/t/rjs-help/124963>\
**Category:** Rails\
**Created:** [January 4, 2008, 3:02am UTC](https://www.ruby-forum.com/t/rjs-help/124963 "2008-01-04T03:02:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamesSz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9fc348/32.png) [@jamesSz](https://www.ruby-forum.com/u/jamesSz)\
**Post date:** [January 4, 2008, 3:02am UTC](https://www.ruby-forum.com/t/rjs-help/124963/1 "2008-01-04T03:02:23Z")

</div>

Hi all,

I am new to both Ruby and Ruby on Rails. I am trying to do the follow  
inside a rjs template (building the Depot application using rails 2.0).

page.replace\_html(“cart”, :partial =\> “cart”, :object =\> @cart)

if @current\_item  
page[:current\_item].visual\_effect(:highlight, :startcolor =\>  
“#88ff88”, :endcolor =\> “#eeeeee”)  
end

This code gets executed when a shopping cart item is removed from the  
cart. It works fine as long as @current\_item is set, but if  
@current\_item is not set then I don’t want the  
page[:current\_item].visual\_effect statement to get excuted.

What am I doing wrong?

JZ
