エントリーの編集
エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
Pitfalls of Rails db transactions
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
Pitfalls of Rails db transactions
Rollback Rails transaction and rescue error to display it good: This is fine record = MyModel.las... Rollback Rails transaction and rescue error to display it good: This is fine record = MyModel.last error_for_user = nil begin ActiveRecord::Base.transaction do # ... record.save! end rescue ActiveRecord::RecordInvalid => e # do something with exception here error_for_user = "Sorry your transaction failed. Reason: #{e}" end puts error_for_user || "Success" source, source2, source3 This is ok as wel