# Can you not \<%= render :action =\> "x" %\> in a view?

**URL:** <https://www.ruby-forum.com/t/can-you-not-render-action-x-in-a-view/142727>\
**Category:** Rails\
**Created:** [July 10, 2008, 9:59pm UTC](https://www.ruby-forum.com/t/can-you-not-render-action-x-in-a-view/142727 "2008-07-10T21:59:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![squeegy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@squeegy](https://www.ruby-forum.com/u/squeegy)\
**Post date:** [July 10, 2008, 9:59pm UTC](https://www.ruby-forum.com/t/can-you-not-render-action-x-in-a-view/142727/1 "2008-07-10T21:59:17Z")

</div>

Have I gotten stupider? I can seem to get this to work. It seems that  
absolutely nothing happens when I do a

\<%= render :controller =\> “patients”, :action =\> “new” %\>

in a view.

Is it not possible? Am I supposed to use RJS?

\<–

| Create a new patient below or \<%= link\_to\_remote "Select an existing", :url =\> { :action =\> "get\_form\_for\_facesheet", :id =\> "1" }, :update =\> { :success =\> "step\_1\_display"}, :loading =\> "document.getElementById('ajax-loader').style.display = 'block';", :complete =\> "document.getElementById('ajax-loader').style.display = 'none';", :html =\> {:style =\> "color:#0066cc"} %\> one. |
| \<% render :action =\> "patient/new" %\> |

–\>

---

<div class="post-metadata">

**Author:** ![squeegy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@squeegy](https://www.ruby-forum.com/u/squeegy)\
**Post date:** [July 10, 2008, 11:33pm UTC](https://www.ruby-forum.com/t/can-you-not-render-action-x-in-a-view/142727/2 "2008-07-10T23:33:16Z")

</div>

Hi Alex,

Alex Williams wrote:

> I can seem to get this to work. It seems that  
> absolutely nothing happens when I do a
> 
> \<%= render :controller =\> “patients”, :action =\> “new” %\>
> 
> in a view.
> 
> Is it not possible?

Not possible that I know of. Certainly not good practice even if it  
were.  
What you’d normally use render for in a view is to render partials,  
which it  
sort of looks like you’re trying to do…

> Am I supposed to use RJS?

… except that you’re using link\_to\_remote which sends an xhr to the  
server  
which, yes, would lead one to believe you’re going to render that  
partial  
using RJS.

From the view below, it looks like you’re interested in the use of Rails  
in  
healthcare. As an aside, I recently open-sourced my first ‘big’ Rails  
app.  
It’s an app using CCRs for new patient registration. You might find it  
interesting. Perhaps even helpful. It’s at  
[http://rubyforge.org/projects/ccredit](http://rubyforge.org/projects/ccredit)

Best regards,  
Bill

---

<div class="post-metadata">

**Author:** ![squeegy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@squeegy](https://www.ruby-forum.com/u/squeegy)\
**Post date:** [July 10, 2008, 11:59pm UTC](https://www.ruby-forum.com/t/can-you-not-render-action-x-in-a-view/142727/3 "2008-07-10T23:59:17Z")

</div>

Bill W. wrote:

> Hi Alex,
> 
> Not possible that I know of. Certainly not good practice even if it  
> were.  
> What you’d normally use render for in a view is to render partials,  
> which it  
> sort of looks like you’re trying to do…
> 
> … except that you’re using link\_to\_remote which sends an xhr to the  
> server  
> which, yes, would lead one to believe you’re going to render that  
> partial  
> using RJS.
> 
> From the view below, it looks like you’re interested in the use of Rails  
> in  
> healthcare. As an aside, I recently open-sourced my first ‘big’ Rails  
> app.  
> It’s an app using CCRs for new patient registration. You might find it  
> interesting. Perhaps even helpful. It’s at  
> [http://rubyforge.org/projects/ccredit](http://rubyforge.org/projects/ccredit)
> 
> Best regards,  
> Bill

Well the reason why is to use activescaffold’s new action. It takes a  
crap on you if you render it’s forms, so I was trying access the action  
directly.

---

<div class="post-metadata">

**Author:** ![squeegy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@squeegy](https://www.ruby-forum.com/u/squeegy)\
**Post date:** [July 11, 2008, 4:51am UTC](https://www.ruby-forum.com/t/can-you-not-render-action-x-in-a-view/142727/4 "2008-07-11T04:51:04Z")

</div>

Hi Alex,

Alex Williams wrote:

> Well the reason why is to use activescaffold’s new action.  
> It takes a crap on you if you render it’s forms, so I was  
> trying access the action directly.

It’s easy to get ‘wrapped around the axel’ with routes, and especially  
nested routes. My personal recommendation is to delete the routes  
stuff  
that’s being scaffolded for you, make the app do what you need it to do,  
then add back the stuff that _might_ help you make the code base  
smaller.

HTH,  
Bill
