my.cnfの中で、clientとserver両方max_allowed_packet を適当に大きな数値に指定する。

   1  max_allowed_packet = 16M

config/database.yml でコネクション切断時に再接続する設定をする。

   1  production:
   2    reconnect: true

これで多分大丈夫。

posted by Png genki on Sat 11 Jun 2011 at 10:05

昔は mysql_retry_lost_connection というものがあったのですが、最近 (Rails-2.3以降) は config/database.yml の中で

   1  production:
   2    reconnect: true

とやるだけで、接続が切れた場合に再接続してくれるようです。 まあ、ここまで用意するならデフォルトでそうなってても良いと思うんですけどね。

posted by Png genki on Sat 11 Jun 2011 at 07:06

Rails-2.3.11用のExceptionNotificationプラグインは以下にあるようです (via @a_matsuda

基本的にはこれを script/plugin install -r 2-3-stable すれば良いのですが、ConsiderLocalの実装にバグがあるので 直す必要があります。

具体的には、以下のファイルの self.included の場所をConsiderLocalモジュールの直下に移動します。

あとはREADME通りに設定して、ConsiderLocalをApplicationControllerからincludeすればok

posted by Png genki on Sat 11 Jun 2011 at 06:51

GitリポジトリのRailsプラグインをインストールするときに、 標準では master ブランチがインストールされますが、 特定のブランチの内容をインストールしたい場合には、以下のように -r オプションを使用します。

   1  script/plugin install --force https://github.com/rails/exception_notification.git -r 2-3-stable

上記の例では 2-3-stable ブランチをインストールします。

posted by Png genki on Sat 11 Jun 2011 at 05:21
Contents
Mysql::Error: Lost connection to MySQL server during queryを鎮める
RailsでDBの接続が切れた場合に再接続する設定
Rails-2.3.11でExceptionNotificationを使う
Gitの指定したブランチからプラグインをインストールする
Comments
瀧内元気: MacOS版は以下にあります * [genki/ViMouse](https://githu... '23-1
KingofSmack: Here also good reads for this mobile applicatio... '14-5
Spencer: You don't have to re-compile it, this version w... '14-4
staiano: Any chance we can get a recompile for 10.9? '14-1
dsjf: https://gist.github.com/6bf1bf2c3cbb5eb6e7a7 これ... '13-1
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ