Multiple questions


#1

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


#2

On 2/7/06, Ron 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/


#3

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.