Rails and ember with acts-as-taggable-on. How to handle relationships in JSONAPI endpoint?

I have a Rails 5 (or 4) application and I need a good tag system.

  • First question: is acts-as-taggable-on still a good choice?

This is my code:

class User < ActiveRecord::Base
  acts_as_taggable_on :tags

class UsersController < ApplicationController
  def user_params
    params.require(:user).permit(:name, :tag_list)

@user = User.new(:name => "Bobby")

I’m able to add and remove with this (from Rails console or code):

  • Second question: how can I handle relationship?

I’ll explain it better: let’s say I’m using Ember (or also Angular or others with JSONAPI, it’s the same for my question), and I’m using ActiveModelSerializer 0.10.x:


import DS from 'ember-data';

export default DS.Model.extend({
  tags: DS.hasMany('tag')


import DS from 'ember-data';

export default DS.Model.extend({
  users: DS.hasMany('user')


let user = this.get('store').peekRecord('user', 1);
let tag = this.get('store').createRecord('tag', {
  user: user

Now I have the problem: how can I say Rails to save this new tag (in taggings table I think)?

Generally when I have a relationships to handle in Ember I create a JSONAPI endpoint in Rails and with foreignKey and CREATE api I save all and it works good. But with acts-as-taggable-on I don’t know how to save.

Maybe I have to generate a new endpoint for taggings and write my own code in a controller to handle savings for tags? Really? Maybe i’m missing something…