<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>tango_ruby</author_name>
  <author_url>https://blog.hatena.ne.jp/tango_ruby/</author_url>
  <blog_title>ベルリンのITスタートアップで働くジャバ・ザ・ハットリの日記</blog_title>
  <blog_url>https://tango-ruby.hatenablog.com/</blog_url>
  <categories>
    <anon>Rails</anon>
    <anon>Ruby</anon>
    <anon>英語</anon>
  </categories>
  <description>Rails4.1からActiveRecord::Enumが使えるようになった。よく使う事例はUserモデルにrole(役割種別）があって、データはIntegerで0ならguest, 1ならuser, 2ならadminの３種類にするって場合。何の説明もなしにuser.role = 1 とかして「1? なに？どういう意味？」とならないように可読性を保ちつつ、変な値を入れさせないようにするのがEnum。ActiveRecordにEnumの指定をする。roleはinteger。 class User &lt; ActiveRecord::Base enum role: [ :guest, :user, :a…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftango-ruby.hatenablog.com%2Fentry%2F2015%2F04%2F21%2F105318&quot; title=&quot;Rails4.1から列挙型enumが使えるが「いなーむ」とか発音すんのやめ - ベルリンのITスタートアップで働くジャバ・ザ・ハットリの日記&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2015-04-21 10:53:18</published>
  <title>Rails4.1から列挙型enumが使えるが「いなーむ」とか発音すんのやめ</title>
  <type>rich</type>
  <url>https://tango-ruby.hatenablog.com/entry/2015/04/21/105318</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
