# About views problem!

**URL:** <https://www.ruby-forum.com/t/about-views-problem/118325>\
**Category:** Rails\
**Created:** [October 25, 2007, 6:58pm UTC](https://www.ruby-forum.com/t/about-views-problem/118325 "2007-10-25T18:58:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![OnRails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/51bf81/32.png) [@OnRails](https://www.ruby-forum.com/u/OnRails)\
**Post date:** [October 25, 2007, 6:58pm UTC](https://www.ruby-forum.com/t/about-views-problem/118325/1 "2007-10-25T18:58:28Z")

</div>

Hi, everyone!  
I have a question. when I created a controller and a action like this:

class EverythingController \< ApplicationController  
def index  
end

def findname  
content=“here is test”  
render :text =\> content, :layout =\> false  
end  
…  
end  
in other controller’s .rhtml, I used  
\<%= render\_component :controller =\> “everything”, :action =\>  
“findname” %\>

so, Do I need create a template \_findname.rhtml for findname action?  
I don’t think I need it, because I just render content, not anything.  
but when I do function test, there is error: Misstemplate  
\_findname.rhtml  
so I don’t understand this error.  
who can tell me why? and how can fix it, Thanks!

---

<div class="post-metadata">

**Author:** ![OnRails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/51bf81/32.png) [@OnRails](https://www.ruby-forum.com/u/OnRails)\
**Post date:** [October 25, 2007, 7:02pm UTC](https://www.ruby-forum.com/t/about-views-problem/118325/2 "2007-10-25T19:02:34Z")

</div>

> Hi, everyone!  
> I have a question. when I created a controller and a action like this:

Hrm… not sure about your specific problem, but components won’t be  
supported in Rails 2.0 which is just around the corner…

> **[Ruby on Rails](https://rubyonrails.org)**
>
> A web-app framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern.

Might want to rethink what you’re trying to do to use another method…

---

<div class="post-metadata">

**Author:** ![OnRails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/51bf81/32.png) [@OnRails](https://www.ruby-forum.com/u/OnRails)\
**Post date:** [October 25, 2007, 7:09pm UTC](https://www.ruby-forum.com/t/about-views-problem/118325/3 "2007-10-25T19:09:01Z")

</div>

On Oct 25, 2007, at 9:58 AM, OnRails wrote:

> in other controller’s .rhtml, I used  
> \<%= render\_component :controller =\> “everything”, :action =\>  
> “findname” %\>
> 
> so, Do I need create a template \_findname.rhtml for findname action?  
> I don’t think I need it, because I just render content, not anything.  
> but when I do function test, there is error: Misstemplate  
> \_findname.rhtml  
> so I don’t understand this error.  
> who can tell me why? and how can fix it, Thanks!

Have a look at this article (and example code) which explains how to  
use & combine views, partials, and layouts.

[http://gregwillits.wordpress.com/2007/10/16/modular-page-layouts-in-](http://gregwillits.wordpress.com/2007/10/16/modular-page-layouts-in-)  
ruby-on-rails/

– gw

---

<div class="post-metadata">

**Author:** ![OnRails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/51bf81/32.png) [@OnRails](https://www.ruby-forum.com/u/OnRails)\
**Post date:** [October 26, 2007, 2:00am UTC](https://www.ruby-forum.com/t/about-views-problem/118325/4 "2007-10-26T02:00:45Z")

</div>

yes, I have looked this article.  
but I just want to know If I used “render :text =\>” to render  
something view not whole page, Do I need create template?

---

<div class="post-metadata">

**Author:** ![OnRails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/51bf81/32.png) [@OnRails](https://www.ruby-forum.com/u/OnRails)\
**Post date:** [October 26, 2007, 12:28pm UTC](https://www.ruby-forum.com/t/about-views-problem/118325/5 "2007-10-26T12:28:28Z")

</div>

No you don’t need a view template if you are just rendering the text  
from an action.

You also don’t need to specify :layout =\> false

just write render :text =\> content

---

<div class="post-metadata">

**Author:** ![OnRails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/51bf81/32.png) [@OnRails](https://www.ruby-forum.com/u/OnRails)\
**Post date:** [October 29, 2007, 11:39pm UTC](https://www.ruby-forum.com/t/about-views-problem/118325/6 "2007-10-29T23:39:04Z")

</div>

Thanks!  
but I just write  
render :text =\> content  
when I do function test, there is Error.  
MissTemplate … findname.rhtml  
so I am not sure where is wrong.
