0
Note
モデルのタグの数を確認するにはどうすればよいですか?現在、私のモデル:Ruby on Rails 5でpg配列の長さを検証する方法は?
# == Schema Information
#
# Table name: notes
#
# id :integer not null, primary key
# title :text
# body :text
# organization_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# tags :string default([]), is an Array
#
# Note represents a saved Note that belongs to an organization.
class Note < ApplicationRecord
belongs_to :organization
validates :title, :body, presence: true
end
tags
は、データベース内のPG配列です。