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.
Be9bdbdbbe6e5dfbb1bb51729a5eab73?d=identicon&s=25 Ron (Guest)
on 2006-02-07 17: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
119af50160cabfe1fb6f2f05f5018c64?d=identicon&s=25 James Ludlow (Guest)
on 2006-02-07 17:57
(Received via mailing list)
On 2/7/06, Ron <rcadier@gmail.com> 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/
3320715fa6264e6309503d5bd089fad2?d=identicon&s=25 Mufaddal Khumri (mkhumri)
on 2006-02-07 18: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.