# Hiding partials when used with rjs

**URL:** <https://www.ruby-forum.com/t/hiding-partials-when-used-with-rjs/128773>\
**Category:** Rails\
**Created:** [February 11, 2008, 1:31pm UTC](https://www.ruby-forum.com/t/hiding-partials-when-used-with-rjs/128773 "2008-02-11T13:31:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tobycatlin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/5e9695/32.png) [@tobycatlin](https://www.ruby-forum.com/u/tobycatlin)\
**Post date:** [February 11, 2008, 1:31pm UTC](https://www.ruby-forum.com/t/hiding-partials-when-used-with-rjs/128773/1 "2008-02-11T13:31:25Z")

</div>

Hi,

I often find myself using partials in the following way when they are  
intended for use with both javascript and html rendering:

– page.html.erb  
render :partial =\> ‘partial’

– page.rjs  
page.replace ‘element’,  
:partial =\> ‘partial’, :locals =\> {:hidden =\> true}  
page.visual\_effect :appear, ‘element’

–\_partial.html.erb  
\<%  
hidden ||= nil  
%\>

\> Whatever

I was wondering whether anyone could suggest a better way of doing  
this as I don’t really like using the hidden ||= nil at the top of  
every partial that is intended for this usage?

Thanks in advance,  
Toby
