2007-10-27 14:51:32 -04:00
|
|
|
class Book < ActiveRecord::Base
|
2010-09-26 08:17:18 -04:00
|
|
|
has_many :authors
|
|
|
|
|
2016-08-06 13:37:57 -04:00
|
|
|
has_many :citations, foreign_key: "book1_id"
|
2013-11-02 15:01:31 -04:00
|
|
|
has_many :references, -> { distinct }, through: :citations, source: :reference_of
|
2010-07-27 16:57:27 -04:00
|
|
|
|
|
|
|
has_many :subscriptions
|
2013-11-02 15:01:31 -04:00
|
|
|
has_many :subscribers, through: :subscriptions
|
2013-11-02 16:08:36 -04:00
|
|
|
|
|
|
|
enum status: [:proposed, :written, :published]
|
2013-11-02 20:48:16 -04:00
|
|
|
enum read_status: {unread: 0, reading: 2, read: 3}
|
2014-01-20 20:10:48 -05:00
|
|
|
enum nullable_status: [:single, :married]
|
2015-07-23 08:27:09 -04:00
|
|
|
enum language: [:english, :spanish, :french], _prefix: :in
|
|
|
|
enum author_visibility: [:visible, :invisible], _prefix: true
|
|
|
|
enum illustrator_visibility: [:visible, :invisible], _prefix: true
|
|
|
|
enum font_size: [:small, :medium, :large], _prefix: :with, _suffix: true
|
2016-08-06 12:26:20 -04:00
|
|
|
enum cover: { hard: "hard", soft: "soft" }
|
2013-11-04 13:36:22 -05:00
|
|
|
|
|
|
|
def published!
|
|
|
|
super
|
|
|
|
"do publish work..."
|
|
|
|
end
|
2007-10-27 14:51:32 -04:00
|
|
|
end
|