Railsのviewやcontrollerの中で、refererやpath_info、アクセス元のip address等を知りたい場合があります。 このような場合は、requestオブジェクトの内容を参照します。 例えば、リクエスト元のアドレスを知りたい場合は、 # リクエスト元のアドレスを知りたい場合 request.remote_addr # リクエストされているページのpath_infoを知りたい場合 request.path_infoなお、cgiの環境変数とrequestオブジェクトの中身の対応は以下のようになっています。 AUTH_TYPE : request.auth_type CONTENT_LENGTH : request.content_length CONTENT_TYPE : request.content_type GATEWAY_INTERFACE : reque
I want to test a file upload in rails, but am not sure how to do this. Here is the controller code: def uploadLicense #Create the license object @license = License.create(params[:license]) #Get Session ID sessid = session[:session_id] puts "\n\nSession_id:\n#{sessid}\n" #Generate a random string chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a newpass = "" 1.upto(5) { |i| newpass << cha
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く