Good community, I have a problem with the simple form gem, since I need to pass a colletion_select to a simple form, to do so gives a method error. I appreciate your help. Thanks!
Good community, I have a problem with the simple form gem, since I need to pass a colletion_select to a simple form, to do so gives a method error. I appreciate your help. Thanks!
Taking the example of your previous question :
<%= collection_select(:project, :name, @projects, :id, :name, prompt: "Seleciona proyecto") %>
You could do something like this:
<%= simple_form_for @object do |f| %>
<%= f.input :project, collection: @projects, label_method: :name, value_method: :id, label: "Proyecto", include_blank: true %>
<!-- Otros inputs -->
<% end %>
Where @object
refers to the object you want to create in the form.