Skip to content

Controllers

andela-oojewale edited this page Jan 14, 2016 · 2 revisions

The following methods can be called in the controller:

  • Params - Supplies all page params. Can be used as:

    params["name_of_param"]

  • Render - Renders a view. Accepts view name as symbol.

    render :index

  • Authenticate - Verifies a password Accepts password as parameter.

    authenticate(your_password)

  • Sessions: Used to store values that you want to persist until they are destroyed or users logs out. Stores a value with the key passed into it.

    session["user_id"] = 1

    Session values can be deleted by calling the clear method on it.

  • Redirect_to: redirects to the given URI. To redirect to the root, use:

    redirect_to /

Clone this wiki locally