Rails 1年生... のまま
うーん、モデルが 1つ増えただけ。進捗が無い orz。テストが通らないのはなぜ?
class Distributor < ActiveRecord::Base belongs_to :payment_term (省略) validates_inclusion_of(:payment_term_id, :in => PaymentTerm.find(:all).collect {|pt| pt.id }, :message => 'が不正です。') end
payment_term_id が PaymentTerm に登録されているデータ以外だったらアウト、にしたいだけなんだけど... belongs_to: って、こういう場合には意味無いんですよね? トホホ... さっぱり分からん +_+)。