Class: Edition

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
FriendlyId, HashableParams
Defined in:
app/models/edition.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HashableParams

#delete_hash, #put_hash

Class Method Details

.get_other_active_editions_from_the_same_work(edition) ⇒ Object


89
90
91
# File 'app/models/edition.rb', line 89

def self.get_other_active_editions_from_the_same_work(edition)
	return Edition.where("work_id = ? and status = ? and id <> ?",edition.work.id,Edition.statuses[:active],edition.id)
end

.missingObject


85
86
87
# File 'app/models/edition.rb', line 85

def self.missing
	return :edition_missing
end

.unknownObject


82
83
84
# File 'app/models/edition.rb', line 82

def self.unknown
	return :edition_unknown
end

Instance Method Details

#coverart_remote_url=(url_value) ⇒ Object


69
70
71
72
# File 'app/models/edition.rb', line 69

def coverart_remote_url=(url_value)
	self.coverart = URI.parse(url_value)
	@coverart_remote_url = url_value
end

#delete_coverartObject


74
75
76
# File 'app/models/edition.rb', line 74

def delete_coverart
	@delete_coverart ||= false
end

#delete_coverart=(value) ⇒ Object


78
79
80
# File 'app/models/edition.rb', line 78

def delete_coverart=(value)
	@delete_coverart  = !value.to_i.zero?
end

#normalize_friendly_id(input) ⇒ Object


31
32
33
# File 'app/models/edition.rb', line 31

def normalize_friendly_id(input)
	input.to_s.to_slug.normalize.to_s
end

#plataform_and_nameObject


35
36
37
38
39
40
# File 'app/models/edition.rb', line 35

def plataform_and_name
	[
		[->{ platform.display_title if platform }, :title],
		[->{ platform.display_title if platform }, ->{ region.title if region }, :title],
	]
end