<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>opiyotan</author_name>
  <author_url>https://blog.hatena.ne.jp/opiyotan/</author_url>
  <blog_title>おぴよの気まぐれ日記</blog_title>
  <blog_url>https://opiyotan.hatenablog.com/</blog_url>
  <categories>
    <anon>Rails</anon>
    <anon>model</anon>
    <anon>バリデーション</anon>
  </categories>
  <description>データを登録する際に利用するフォームですが、条件に応じて必須だったり制限したりする仕組みを「バリデーション」といいます。 Ruby on Railsでは以下のような感じで設定することができます。 class Hoge &lt; ApplicationRecord validates :name, presence: true end # validationがない場合 &gt; hoge = Hoge.new =&gt; #&lt;Hoge:0x00007f803eabca78 id: nil, name: &quot;&quot;, age: 0, gender: &quot;man&quot;, birthday: Mon, 01 Jan 1900, …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fopiyotan.hatenablog.com%2Fentry%2Fmodel_validations&quot; title=&quot;【Rails】バリデーションをまとめてみる - おぴよの気まぐれ日記&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>https://cdn.user.blog.st-hatena.com/default_entry_og_image/110785513/1514221383750427</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2019-09-24 21:29:22</published>
  <title>【Rails】バリデーションをまとめてみる</title>
  <type>rich</type>
  <url>https://opiyotan.hatenablog.com/entry/model_validations</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
