<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>shinkufencer</author_name>
  <author_url>https://blog.hatena.ne.jp/shinkufencer/</author_url>
  <blog_title>コード日進月歩</blog_title>
  <blog_url>https://shinkufencer.hateblo.jp/</blog_url>
  <categories>
    <anon>Rails</anon>
  </categories>
  <description>設定しているときに無視したいという特殊なケースの対策。基本は打ち消しをしないことを前提に書いたほうがよいが書かざるを得ないときにどうするかのためのメモ。 環境 $ bin/rails -v Rails 7.1.2 前提 has_manyなどの子の関連に関して、デフォルトの並び順を設定することができる。詳しくは以下の記事を参照のこと。 RailsのActiveRecordのhas_manyにはorderで順番の指定できる - コード日進月歩 例 例えば以下のようなModelがあったとする # == Schema Information # # Table name: soccer_teams #…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fshinkufencer.hateblo.jp%2Fentry%2F2024%2F01%2F06%2F000000&quot; title=&quot;has_manyでorderを設定したものを無視したいときはreorderを使う - コード日進月歩&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>2024-01-06 00:00:00</published>
  <title>has_manyでorderを設定したものを無視したいときはreorderを使う</title>
  <type>rich</type>
  <url>https://shinkufencer.hateblo.jp/entry/2024/01/06/000000</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
