# Multiple questions

**URL:** <https://www.ruby-forum.com/t/multiple-questions/102060>\
**Category:** Rails\
**Created:** [February 7, 2006, 5:49pm UTC](https://www.ruby-forum.com/t/multiple-questions/102060 "2006-02-07T17:49:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ecae2f/32.png) [@ron](https://www.ruby-forum.com/u/ron)\
**Post date:** [February 7, 2006, 5:49pm UTC](https://www.ruby-forum.com/t/multiple-questions/102060/1 "2006-02-07T17:49:31Z")

</div>

I have a heard time finding good searchable documentation about ruby. So  
ill ask some stuff here.

1. Can i use multiple layouts in the same controller, and somehow switch  
between them? If so how?
2. Can i import a view into another view? If so how?
3. Can i check if a value is in a field using an if-statement, for  
instance checking if there is a ‘1’ in a field containing ‘12345’?

thx a bunch

---

<div class="post-metadata">

**Author:** ![ron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ecae2f/32.png) [@ron](https://www.ruby-forum.com/u/ron)\
**Post date:** [February 7, 2006, 5:57pm UTC](https://www.ruby-forum.com/t/multiple-questions/102060/2 "2006-02-07T17:57:54Z")

</div>

On 2/7/06, Ron [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 1. Can i check if a value is in a field using an if-statement, for  
> instance checking if there is a ‘1’ in a field containing ‘12345’?

Look up the String.index method.

[http://corelib.rubyonrails.org/](http://corelib.rubyonrails.org/)

---

<div class="post-metadata">

**Author:** ![ron](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ecae2f/32.png) [@ron](https://www.ruby-forum.com/u/ron)\
**Post date:** [February 7, 2006, 6:19pm UTC](https://www.ruby-forum.com/t/multiple-questions/102060/3 "2006-02-07T18:19:39Z")

</div>

Multiple answers by your mulitple questions,

Ron wrote:

> I have a heard time finding good searchable documentation about ruby. So  
> ill ask some stuff here.
> 
> 1. Can i use multiple layouts in the same controller, and somehow switch  
> between them? If so how?

Yes. You can specify which layout to use. Also if there is a default  
layout being used in your controller you can control if you want to use  
it or not when a certain action is invoked within that controller.

For example you can do:  
render :action =\> “clap\_yourhands”, :layout =\> “circles\_and\_triangles”

> 1. Can i import a view into another view? If so how?

Yes. Look at render :partial and / or render :component

> 1. Can i check if a value is in a field using an if-statement, for  
> instance checking if there is a ‘1’ in a field containing ‘12345’?

“Peekaboo”.index(e)

> thx a bunch

Hope that helps,

-Mufaddal.
