2019-08-13から1日間の記事一覧
え、こんなコトできるの?っていうやつ。 環境 $ bin/rails -v Rails 5.2.2 やり方 has_manyのあとにorderをあしらう has_many :対象モデル, -> { order("order by のあとのSQL文章") } 例 今回のモデル # == Schema Information # # Table name: users # # …
え、こんなコトできるの?っていうやつ。 環境 $ bin/rails -v Rails 5.2.2 やり方 has_manyのあとにorderをあしらう has_many :対象モデル, -> { order("order by のあとのSQL文章") } 例 今回のモデル # == Schema Information # # Table name: users # # …