# Render action from another controller

**URL:** <https://www.ruby-forum.com/t/render-action-from-another-controller/139934>\
**Category:** Rails\
**Created:** [June 9, 2008, 9:47am UTC](https://www.ruby-forum.com/t/render-action-from-another-controller/139934 "2008-06-09T09:47:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [June 9, 2008, 9:47am UTC](https://www.ruby-forum.com/t/render-action-from-another-controller/139934/1 "2008-06-09T09:47:57Z")

</div>

I would like to have one page staying the same all the time, and have  
actions being included with Ajax. On the main page I have a div used for  
the purpose of adding forms belonging to other models than the current  
main controller and layout. Is this possible? I can render the form but  
only if I exclude the fields, why? I use fields like:

\<%= text\_field ‘othermodel’, ‘test’ %\>

My form action points to create in that other model.

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [June 9, 2008, 10:14am UTC](https://www.ruby-forum.com/t/render-action-from-another-controller/139934/2 "2008-06-09T10:14:32Z")

</div>

> \<%= text\_field ‘othermodel’, ‘test’ %\>

Do you get any errors?

if you render this, then you should have assigned an attribute like  
@othermodel = Othermodel.new

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [June 9, 2008, 10:24am UTC](https://www.ruby-forum.com/t/render-action-from-another-controller/139934/3 "2008-06-09T10:24:33Z")

</div>

Thorsten M. wrote:

> > \<%= text\_field ‘othermodel’, ‘test’ %\>
> 
> Do you get any errors?
> 
> if you render this, then you should have assigned an attribute like  
> @othermodel = Othermodel.new

I think I found the error. I had a submit instead of a submit\_tag. It  
works now, at least I get the form to render.
