# Include once in partial

**URL:** <https://www.ruby-forum.com/t/include-once-in-partial/82639>\
**Category:** Rails\
**Created:** [March 16, 2006, 5:25pm UTC](https://www.ruby-forum.com/t/include-once-in-partial/82639 "2006-03-16T17:25:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![GSSSSbor\_SebestySSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/3bc359/32.png) [@GSSSSbor\_SebestySSS](https://www.ruby-forum.com/u/GSSSSbor_SebestySSS)\
**Post date:** [March 16, 2006, 5:25pm UTC](https://www.ruby-forum.com/t/include-once-in-partial/82639/1 "2006-03-16T17:25:11Z")

</div>

Hi!

I have to include javascript code into my partial but I should do it  
once. How can I do that?  
What is the rule of thumb?

Gábor

---

<div class="post-metadata">

**Author:** ![GSSSSbor\_SebestySSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/3bc359/32.png) [@GSSSSbor\_SebestySSS](https://www.ruby-forum.com/u/GSSSSbor_SebestySSS)\
**Post date:** [March 16, 2006, 5:34pm UTC](https://www.ruby-forum.com/t/include-once-in-partial/82639/2 "2006-03-16T17:34:50Z")

</div>

On Thu, 2006-03-16 at 17:19 +0100, GÃ¡bor SebestyÃ©n wrote:

> Hi!
> 
> I have to include javascript code into my partial but I should do it  
> once. How can I do that?  
> What is the rule of thumb?

* * *

you would put it into whichever file has the

code which is generally the ‘layout’ file for the controller.

Craig
