Class: Gallerist::Person

Inherits:
PersonModel show all
Defined in:
lib/gallerist/models/person.rb

Overview

This code is free software; you can redistribute it and/or modify it under the terms of the new BSD License.

Copyright © 2015, Sebastian Staudt

Instance Method Summary collapse

Methods inherited from BaseModel

iphoto, photos, setup_for, store_setup

Instance Method Details

#inspectObject



32
33
34
# File 'lib/gallerist/models/person.rb', line 32

def inspect
  "#<%s id=%d name='%s'>" % [ self.class, id, name ]
end

#photosObject

ActiveRecord does not support has_many-through associations across different databases, so we have to query the photos manually



38
39
40
# File 'lib/gallerist/models/person.rb', line 38

def photos
  Gallerist::Photo.where modelId: person_photos.map(&:photo_id)
end

#to_sObject



42
43
44
# File 'lib/gallerist/models/person.rb', line 42

def to_s
  name
end