I got this model:
class Book < ActiveRecord::Base
mount_uploader :image, ImageUploader
belongs_to :editor
belongs_to :catalog
has_many :catalogs
end
_form.html.erb:
<div class="field">
<%= f.label :catalog_id %><br>
<%= f.collection_select(:catalog_id, @catalogs, :id, :ano, {:prompt => "Segure CTRL para seleção múltipla"}, {:multiple => true}) %>
</div>
controller:
params.require(:book).permit(:title, :format, :npag, :isbn, :sinopse, :image, :catalog_ids => [])
I can create new books but in the show.html.erb doesn't appear the selected itens, what is wrong?
I didn't change the show:
<%= @book.catalog %>