Forum: Ruby on Rails Multiple questions

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ron (Guest)
on 2006-02-07 18:49
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
James L. (Guest)
on 2006-02-07 18:57
(Received via mailing list)
On 2/7/06, Ron <removed_email_address@domain.invalid> wrote:
> 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'?

Look up the String.index method.

http://corelib.rubyonrails.org/
Mufaddal K. (Guest)
on 2006-02-07 19:19
(Received via mailing list)
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"

>2. Can i import a view into another view? If so how?
>
>
Yes. Look at render :partial and / or render :component

>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'?
>
>
>
"Peekaboo".index(e)

>thx a bunch
>
>
>
Hope that helps,

-Mufaddal.
This topic is locked and can not be replied to.