how do i use a ruby if statement in a js.erb file?

jquery, ruby-on-rails

Solution

<% if @cart.total_items ==1 %>
  $('#cart').show(2000);
<% end %>

Problem

I need to do something like shown below; add a jquery effect depending on the value of an instance object in rails ``` ("$('#cart').show(2000);") if @cart.total_items ==1 ```

Original source