Commit 856e8c39 authored by Michael Rose's avatar Michael Rose

add gender virtual field

parent 936a8c1d
......@@ -12,6 +12,18 @@
class Character < ActiveRecord::Base
belongs_to :fandom
def gender
if isfemale.nil?
return :unknown
end
if isfemale?
:female
else
:male
end
end
def self.for_fandoms(fandoms)
if fandoms && fandoms.size > 1
if fandoms.include?(-1)
......
......@@ -5,9 +5,9 @@ json.author do
json.external_url story.author.url
end
json.(story, :status, :language, :rated, :chapters, :favs, :follows, :reviews, :words)
json.characters story.characters, :id, :name, :isfemale
json.characters story.characters, :id, :name, :gender
json.categories story.categories, :name
json.fandoms story.fandoms, :name
json.relationships story.relationships do |relationship|
json.array! relationship, :id, :name, :isfemale
json.array! relationship, :id, :name, :gender
end
\ No newline at end of file
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