rails cはテスト用に一時的な初期値をぶっ込むときに楽です。
cはconsoleの略です
irb(main):001:0> Player.find(1).food.update_attribute(:pt, 10_000) {略} => true
実行SQLが実行されます。
小ネタ
補完機能
TABを打つと補完してくれます。
$ rails c Loading development environment (Rails 4.0.1) irb(main):001:0> Player.find(1).food.app<TAB> 1).food.app 1).food.append_before_action 1).food.application_trace 1).food.app_cache_dirname 1).food.append_before_filter 1).food.apply 1).food.app_generators 1).food.append_extension 1).food.apply_attributes 1).food.app_middleware 1).food.append_extensions 1).food.apply_common_behavior_for 1).food.append 1).food.append_features 1).food.apply_finder_options 1).food.append_after 1).food.append_info_to_payload 1).food.apply_join_dependency 1).food.append_after_action 1).food.append_merge! 1).food.apply_runtime_patch 1).food.append_after_filter 1).food.append_path 1).food.apply_to_attribute_or_variable 1).food.append_around_action 1).food.append_paths 1).food.appname 1).food.append_around_filter 1).food.append_traits 1).food.approximate_recommendation
流石にローカルメソッドまでは面倒見てくれないようです。
それでもActiveRecordのメソッドを補完してくれるので超便利です。
タイポしないで書くのも大変ですしね...
--sandbox
お砂場もあります。
このオプションをつけると、console終了時に変更内容を破棄してくれます。