Skip to content

Commit

Permalink
Move related_text to Publication model (see papyri#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanfb committed Jun 27, 2016
1 parent d9a68e9 commit 8f17a67
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/hgv_trans_identifier.rb
Expand Up @@ -53,7 +53,7 @@ def xml_title_text
# - *Returns* :
# - new translation identifier
def self.new_from_template(publication)
if self.related_text.nil?
if publication.related_text.nil?
raise 'No related text to create translation from—this error may occur because the only text associated with this publication is a reprint stub.'
return nil
end
Expand All @@ -66,7 +66,7 @@ def self.new_from_template(publication)

# Returns the 'last' DDB Text identifier that is not a reprint in this tranlsations publication
def related_text
self.publication.identifiers.select{|i| (i.class == DDBIdentifier) && !i.is_reprinted?}.last
self.publication.related_text
end

# Place any actions you always want to perform on translation identifier content prior to it being committed in this method
Expand Down
4 changes: 4 additions & 0 deletions app/models/publication.rb
Expand Up @@ -1523,6 +1523,10 @@ def creatable_identifiers
return creatable_identifiers
end

def related_text
self.identifiers.select{|i| (i.class == DDBIdentifier) && !i.is_reprinted?}.last
end

protected
#Returns title string in form acceptable to ".git/refs/"
def title_to_ref(str)
Expand Down

0 comments on commit 8f17a67

Please sign in to comment.