# Trouble with render :partial from controller

**URL:** <https://www.ruby-forum.com/t/trouble-with-render-partial-from-controller/98632>\
**Category:** Rails\
**Created:** [July 17, 2006, 3:34am UTC](https://www.ruby-forum.com/t/trouble-with-render-partial-from-controller/98632 "2006-07-17T03:34:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeffpritchard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@jeffpritchard](https://www.ruby-forum.com/u/jeffpritchard)\
**Post date:** [July 17, 2006, 3:34am UTC](https://www.ruby-forum.com/t/trouble-with-render-partial-from-controller/98632/1 "2006-07-17T03:34:24Z")

</div>

Hi,  
I’m definitely a newbie on rails here. My very first attempt has gone  
well up until this point, but for some reason, when I try to do a render  
partial, I’m getting a full screen refresh.

I did a render partial just fine from an rhtml file. This problem is  
specifically when calling render :partial =\> “my\_partial” from the  
controller’s .rb code. It’s just really one line that is not doing what  
it’s supposed to…

```
render :partial => "my_partial_file"

```

It is indeed finding the file (\_my\_partial\_file.rhtml) and rendering it,  
but it is not doing it as a partial. It is refreshing the screen and  
rendering this partial file without any of the original page goodies.

thanks,  
jp

P.S.  
A friend of mine is trying to get me to use the scriptaculous  
visual\_effect stuff to do this, and I probably will, but first I would  
like to understand what’s going on with a simple render :partial.

---

<div class="post-metadata">

**Author:** ![jeffpritchard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@jeffpritchard](https://www.ruby-forum.com/u/jeffpritchard)\
**Post date:** [July 17, 2006, 4:47am UTC](https://www.ruby-forum.com/t/trouble-with-render-partial-from-controller/98632/2 "2006-07-17T04:47:53Z")

</div>

* * *

Rails mailing list  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

---

<div class="post-metadata">

**Author:** ![jeffpritchard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@jeffpritchard](https://www.ruby-forum.com/u/jeffpritchard)\
**Post date:** [July 17, 2006, 11:34am UTC](https://www.ruby-forum.com/t/trouble-with-render-partial-from-controller/98632/3 "2006-07-17T11:34:09Z")

</div>

Jeff P. wrote:

> Hi,  
> I’m definitely a newbie on rails here. My very first attempt has gone  
> well up until this point, but for some reason, when I try to do a render  
> partial, I’m getting a full screen refresh.
> 
> I did a render partial just fine from an rhtml file. This problem is  
> specifically when calling render :partial =\> “my\_partial” from the  
> controller’s .rb code. It’s just really one line that is not doing what  
> it’s supposed to…
> 
> ```
> render :partial => "my_partial_file"
> 
> ```

If you render a partial directly from an action, and that action has  
_not_ been called via Ajax, the partial is all you’ll get.

If you’re trying to update just a portion of the screen, that action  
would need to be called via ajax, and told which div to replace/update  
etc.

Are you invoking the action via Ajax (link\_to\_remote, etc)

Alan

---

<div class="post-metadata">

**Author:** ![jeffpritchard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@jeffpritchard](https://www.ruby-forum.com/u/jeffpritchard)\
**Post date:** [July 17, 2006, 5:04pm UTC](https://www.ruby-forum.com/t/trouble-with-render-partial-from-controller/98632/4 "2006-07-17T17:04:06Z")

</div>

Alan F. wrote:

> If you render a partial directly from an action, and that action has  
> _not_ been called via Ajax, the partial is all you’ll get.
> 
> If you’re trying to update just a portion of the screen, that action  
> would need to be called via ajax, and told which div to replace/update  
> etc.
> 
> Are you invoking the action via Ajax (link\_to\_remote, etc)
> 
> Alan

Alan, thanks, that did the trick!

jp
