Commit 4bfc9afb authored by Michael Rose's avatar Michael Rose

story api: add tags

parent 8c7618d4
require 'scryer/tagging/content_tagger'
class Story < ActiveRecord::Base
belongs_to :author
has_one :story_to_thread
......@@ -59,6 +61,12 @@ class Story < ActiveRecord::Base
"https://www.fanfiction.net/s/#{id}/1/#{url_slug}"
end
def tags
Scryer::Tagging::ContentTagger.tag(self).map do |tag|
Tag.new(name: tag[0], system: true)
end
end
## update method
## updates story row, adds story update if changed, indexes into ES
def self.update(doc)
......
......@@ -4,6 +4,7 @@ json.author do
json.(story.author, :id, :name)
json.external_url story.author.url
end
json.tags story.tags, :name, :system
json.(story, :published, :updated, :last_seen)
json.(story, :status, :language, :rated, :chapters, :favs, :follows, :reviews, :words)
json.characters story.characters, :id, :name, :gender
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment