Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?

TL;DR ActiveRecord::Enumで、安易に値を追加・削除するのは危険。将来の変更に備えて、DBに登録される値をHashで指定しましょう。 class User < ActiveRecord::Base # This is BAD enum authority: [:registrant, :admin] # This is OK enum authority: { registrant: 10, admin: 20 } end 本編 年度も変わりさて心機一転、という季節なのに私の地元は昨日大雪でしたが、皆様いかがお過ごしでしょうか。さて今日は表題の通り、Rails 4.1における目玉のひとつ、ActiveRecord Enumsについてです。 ActiveRecord Enumsとは 例えばUserモデルにauthority(権限)という属性を持たせたい時によくやるのは、D
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く