If I have the @mis_clases
array variable in the controller:
bloques_controller
def new
@bloque = Bloque.new
@mis_clases = Array.new
end
And I try to pass it to view, to fill it with clases:
form.html.erb
<div class="card-body">
<%= form.fields_for :clases do |clase| %>
<%= render partial: 'clase_fields' %>
<% @mis_clases << clase %>
<% end %>
</div>
And access it back in the controller:
bloques_controller
def create
@bloque = Bloque.new(bloque_params)
@mis_clases.each do |clase|
# Do something
end
...
end
I want to access the variable again when I save the form, but it throws this error: