facebook twitter hatena line google mixi email

Ruby/rails/環境変数

提供: 初心者エンジニアの簡易メモ
移動: 案内検索

環境変数

require 'logger'
log = Logger.new('/tmp/log')
log.debug(Rails.env)

環境一覧

development 開発
test テスト
staging ステージング
production 本番

request一覧

request.auth_type            # AUTH_TYPE
request.content_length       # CONTENT_LENGTH
request.content_type         # CONTENT_TYPE
request.gateway_interface    # GATEWAY_INTERFACE
request.path_info            # PATH_INFO
request.path_translated      # PATH_TRANSLATED
request.query_string         # QUERY_STRING
request.remote_addr          # REMOTE_ADDR
request.remote_host          # REMOTE_HOST
request.remote_ident         # REMOTE_IDENT
request.remote_user          # REMOTE_USER
request.request_method       # REQUEST_METHOD
request.script_name          # SCRIPT_NAME
request.server_name          # SERVER_NAME
request.server_port          # SERVER_PORT
request.server_protocol      # SERVER_PROTOCOL
request.server_software      # SERVER_SOFTWARE
request.accept               # HTTP_ACCEPT
request.accept_charset       # HTTP_ACCEPT_CHARSET
request.accept_encoding      # HTTP_ACCEPT_ENCODING
request.accept_language      # HTTP_ACCEPT_LANGUAGE
request.cache_control        # HTTP_CACHE_CONTROL
request.from                 # HTTP_FROM
request.host                 # HTTP_HOST
request.negotiate            # HTTP_NEGOTIATE
request.pragma               # HTTP_PRAGMA
request.referer              # HTTP_REFERER
request.user_agent           # HTTP_USER_AGENT
request.raw_cookie           # HTTP_COOKIE
request.raw_cookie2          # HTTP_COOKIE2
request.request_uri          # REQUEST_URI