I have an angular form that is creating an object with tags:
<form class="form-horizontal" ng-submit="createBeacon(beaconData)">
<div class="form-group">
<label>Tags</label>
<div id="tags-list" data-current-user-company="{{current_user.company_id}}">
<input type="text" id="tags-input" class="form-control" ng-model="beaconData.tag_list" name="beacon[tag_list]" placeholder="project, client 72, yellow, design"/>
</div>
</div>
This form is submitting to a rails controller with a factory to commit to the database. Here is the function submitting the data:
$scope.createBeacon = function(beacon){
Beacon.save({
alias: beacon.alias,
description: beacon.description,
status: beacon.status,
company_id: currentUser.company_id,
venue_id: beacon.venue_id,
beacon_id: beacon.beacon_id,
tag_list: beacon.tag_list
});
}
The result is the tag_list being passed as a parameter to to Rails as seen in the server log below but it does not commit into the tags and taggings tables as it would if being submitted with a Rails form.
Any suggestions on what to do here?
Changing the strong parameters line from:
params.require(beacon).permit([:tag_list])
to:
params.permit([:tag_list])
fixed the issue of the tag_list not committing to the tags table. I know this is not preferable but it is the only solution I have found thus far.