19. 条件式が後ろにあってもいける [PHP] if ($hoge) { foo($hoge); } if ($max) { for ($cnt = 0 ; $cnt < $max;$cnt++ ) { print $cnt; } } [ruby] foo(hoge) if hoge max.times do |cnt| p cnt end if max
26. 複数のデータベースに接続 legary: adapter: mysql database: 192.168.0.33 username: user password: pass host: legary_host new: adapter: mysql database: 192.168.0.44 username: user password: pass host: new_host class LegacyClient < ActiveRecord::Base establish_connection "legary" end class Client < ActiveRecord::Base establish_connection "new" End
28. Single Table Inheritance テーブルは同一だが別クラスとして定義できる データの格納先は一つのテーブルだが複数の実装 アイテムやイベントの実装に最適 class RecoveryItem < Item def use(inventry) … end end class OffensiveItem < Item def use(inventry) … end end