How to make custom scope acts-as-taggable-on

131 views Asked by At

I have Profile model, I have Tags (skills and interests) made with ActsAsTaggableOn

ActsAsTaggableOn::Tag (id, name, created_at, tag_count)

ActsAsTaggableOn::Tagging(id, tag_id, tagger_type, tagger_id, context, created_at,taggable_type, taggable_id)

How do I sort skills by name through the model relationship? It should look something like this:

has_many :publications_desc, -> { order(created_at: :desc).limit(30) }, class_name: 'Publication'

1

There are 1 answers

0
Alex Smith On

Yo, seems I found solution for me

has_many :named_thing, lambda {
    'do what you want'
  }, through: :taggings, source: :tag