Flowdock

Filters added to this controller apply to all controllers in the application. Likewise, all the methods added will be available for all controllers.

Show files where this class is defined (1 file)
Register or log in to add new notes.
June 23, 2010
2 thanks

Accessing controller data

You can access controller attributes from views via the @controller variable.

It has some important attributes:

  • @controller.controller_name -> the name of the controller

  • @controller.request -> returns the ActionController::Request

    • @controller.request.method -> the request method ( get, post, put, delete )

    • @controller.request.host -> the request host ( ip address or hostname ) where your server runs

    • @controller.request.ip -> the ip where your browser runs