forms - Get values from checkboxes Ruby on Rails, Many to Many -



forms - Get values from checkboxes Ruby on Rails, Many to Many -

i'm trying values checkboxes in form. form:

<%= form_for @book |f| %> <%= f.label :title %> <%= f.text_field :title %> <%= f.label :description %> <%= f.text_area :description %> <% @users.each |user| %> <%= check_box_tag 'user_ids[]', user.id,false -%> <%= h user.name -%> <% end %> <%= f.submit "save" %> <% end %>

the book has_and_belongs_to_many users, want add together user ids checkboxes @book.users. how can that? maintain getting error: can't mass-assign protected attributes: user_ids.

in model add together line , seek out

attr_accessor :user_ids

ruby-on-rails forms checkbox many-to-many

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -