I'm getting "spans invalid" error when saving a job record that:
#job.rb
class Job < ApplicationRecord
has_many :workspans
has_many :spans, through: :workspans
end
I didn't get this error in rails 5.0, but on upgrading, I can't associate the spans.
The data is coming from a fairly standard rails form, with a checkbox for each span.
#new.html.erb
<%= Span.each do |span| %>
<%= check_box_tag "job[span_ids][]", span.id %>
<% end %>
What has changed and how should I now set up the form to associate the spans with the @job ?
UPDATE, Detail
#jobs_controller
def create
@job = Job.new(job_params)
if @job.save
flash[:success] = "Job Saved"
redirect_to action: :index
else
flash[:alert] = "Job Not Saved"
render 'new'
end
end