My Proposal.rb has:
class Proposal < ApplicationRecord include Statesman::Adapters::ActiveRecordQueries
acts_as_taggable
acts_as_taggable_on :randd_maturities, :randd_fields, :randd_purposes, :randd_activities
My proposal form.html.erb has:
<%= f.collection_select :randd_field_list, Randd::Field.order(:title), :id, :title, {}, {multiple: true} %>
My proposal controller whitelists the randd_field_list with:
def proposal_params
params.require(:proposal).permit(:title, randd_maturities_list: [], randd_field_list: [], randd_purposes_list: [], randd_activities_list: [],
When I try selecting a tag from my form, I get no errors but the tag doesnt save to the proposal:
Processing by ProposalsController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"MO4g02iQgHALwVGBgVp7UN9MQvRa5uaJ56e7/tV3TTqk2UW40CLfEdrJCgafFsBNSuZEoEApXHRl3xp0zmo7Iw==", "proposal"=>{"title"=>"asdf", "randd_field_list"=>["", "1"]
How do I get the form selection title to save as the tag for that proposal?
Try using this code.
Add only this line in your model.
Add this to your controller
Add this to your form. My code is for simple_form_for
If you are using form for use this.