Masahiro Okubo

Show object column using association in simple_form

Show object column using association in simple_form

You can show specific column name in association check_boxes in simple form.
Like this.

= f.association :prefectures, as: :check_boxes,
      label_method: lambda { |prefecture|  JpPrefecture::Prefecture.find(prefecture.prefecture_code).name}
目次
  1. References

References

Simple form association custom label name


関連記事

copyright© 2016-2021 Masahiro Okubo