<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>l-light-note</author_name>
  <author_url>https://blog.hatena.ne.jp/l-light-note/</author_url>
  <blog_title>めもめも のーと</blog_title>
  <blog_url>https://l-light-note.hatenablog.com/</blog_url>
  <categories>
    <anon>ruby</anon>
  </categories>
  <description>Railsのvalidationルールにinclusionがあるが、含まれる値をinに指定する際には注意が必要。 Rails Guideでも使っているが、配列を表現するために %wを使う場合、中身は文字列になるので、数字を検証したい場合は要注意。 例えば %w(0 1 2) と [0, 1, 2]は別物なのである。 %wは文字列扱いになるので、[&quot;0&quot;, &quot;1&quot;, &quot;2&quot;] ということになる。 読み読むとrubydocにも「文字列の配列を簡単に表現できる」と書いてある。 https://docs.ruby-lang.org/ja/latest/doc/spec=2fliteral.html#p…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fl-light-note.hatenablog.com%2Fentry%2F2017%2F10%2F16%2F162925&quot; title=&quot;Rubyの%wを使うときは型に気を付けよう - めもめも のーと&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>2017-10-16 16:29:25</published>
  <title>Rubyの%wを使うときは型に気を付けよう</title>
  <type>rich</type>
  <url>https://l-light-note.hatenablog.com/entry/2017/10/16/162925</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
