Class: SeriesStatementMergeList

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/series_statement_merge_list.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.per_pageObject



7
8
9
# File 'app/models/series_statement_merge_list.rb', line 7

def self.per_page
  10
end

Instance Method Details

#merge_series_statements(selected_series_statement) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/models/series_statement_merge_list.rb', line 11

def merge_series_statements(selected_series_statement)
  series_statements.each do |series_statement|
    if series_statement == selected_series_statement
      series_statement.root_manifestation.update_attributes!({
        :original_title => selected_series_statement.original_title,
        :title_transcription => selected_series_statement.title_transcription,
        :title_alternative => selected_series_statement.title_alternative
      }) if series_statement.root_manifestation
    else
      series_statement.manifestations.each do |manifestation|
        manifestation.series_statement = selected_series_statement
        manifestation.save!
      end
      series_statement.destroy
    end
  end
end