Skip to content

Instantly share code, notes, and snippets.

@drusepth
Created May 2, 2017 18:56
Show Gist options
  • Save drusepth/d31802c5ac2b6c070b86dca4a5b2519c to your computer and use it in GitHub Desktop.
Save drusepth/d31802c5ac2b6c070b86dca4a5b2519c to your computer and use it in GitHub Desktop.
class Character < ActiveRecord::Base
validates :name, presence: true
belongs_to :user
validates :user_id, presence: true
include BelongsToUniverse
include HasAttributes
include HasPrivacy
include HasContentGroupers
include HasImageUploads
include Serendipitous::Concern
include Authority::Abilities
self.authorizer_name = 'CoreContentAuthorizer'
# Characters
relates :fathers, with: :fatherships
relates :mothers, with: :motherships
relates :siblings, with: :siblingships
relates :spouses, with: :marriages
relates :children, with: :childrenships
relates :best_friends, with: :best_friendships
relates :archenemies, with: :archenemyship
# Locations
relates :birthplaces, with: :birthings
# Races
relates :races, with: :raceships
# Languages
relates :spoken_languages, with: :lingualisms
def description
role
end
def self.content_name
'character'
end
def self.color
'red'
end
def self.icon
'group'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment