0
で2つのワードをcollection_select? ありがとうございましたRailsは、私が選択しcollectio持っ名前
で2つのワードをcollection_select? ありがとうございましたRailsは、私が選択しcollectio持っ名前
モデルに:name
と:surname
の属性があると仮定すると、最も簡単な方法はメソッドを追加することです。
class Supplier < ActiveRecord::Base
# ...
def full_name
"#{name} #{surname}"
end
end
次に、あなたのcollection_select
引数に:full_name
代わりの:name
を使用しますので、のようにそれに:full_name
、。