タグ

関連タグで絞り込む (1)

タグの絞り込みを解除

railsに関するngyukiのブックマーク (3)

  • Use a fake DB adapter to avoid connection errors with rails assets precompile

    If you've been using the rails asset pipeline for some time, chances are that you've run into one of these errors when trying to precompile the assets: RAILS_ENV=production bin/rake assets:precompile => rake aborted! FATAL: database "..." does not exist // PG::ConnectionBad: could not connect to server: Connection refused Usually we would just go ahead and create the db, but this time we wanted to

    Use a fake DB adapter to avoid connection errors with rails assets precompile
    ngyuki
    ngyuki 2019/08/23
    assets:precompile で DB 接続してしまう問題、config.assets.initialize_on_precompile = false だけではダメなことがあって最後の手段が nulldb アダプタ
  • Rails Asset Pipeline compilation and Docker

    As you may now Rails asset pipeline (a.k.a. Sprockets) compress your assets (JS, CSS, …) and inserts hash into file name so that CDN can pick up the change: So if you had app.js you will have app-908e25f4bf641868d8683022a5b62f54.js this way your app will interpret: <html> <head> <%= javascript_include_tag 'app' %> <head> To <html> <head> <script src="https://dxxxxxxxxx6lt.cloudfront.net/assets/app

    ngyuki
    ngyuki 2019/08/23
    うーん、そもそも RAILS_ENV によって assets:precompile の結果が変わることがあるらしいのでイメージであらかじめアセットをビルドしておくのは問題もあるっぽい
  • LAN内でリバースプロキシを使用した場合の request.remote_ip - Qiita

    はまったのん… 環境 Rails 4.0.1 nginx + Unicorn リバースプロキシを利用した場合のアクセス元アドレス 通常、リバースプロキシ (nginxなどのウェブサーバを含む; 以下単にプロキシ) を利用した場合、アクセス元はプロキシ側のIPアドレスとなるため実際のアドレスを知ることが出来ない。このため、プロキシ側ではリクエストヘッダ (Client-IP: など) にアクセス元のアドレスを含めることが多い。Webサーバはこの値を読んで来のアドレスを知ることが出来る。 Railsでは request.env 中の情報を利用して、実際のリモートホストを取得することが出来る。ただし、request.remote_ip でヘッダの情報を処理した "正しい" リモートホストを参照することができるため、直接ヘッダの情報を参照するメリットはあまり無い。(この機能は ActionPac

    LAN内でリバースプロキシを使用した場合の request.remote_ip - Qiita
    ngyuki
    ngyuki 2015/02/06
    ActionDispatch::RemoteIp::TRUSTED_PROXIES
  • 1