enju_resource_merge 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,13 @@ class SeriesStatementMergeList < ActiveRecord::Base
10
10
 
11
11
  def merge_series_statements(selected_series_statement)
12
12
  series_statements.each do |series_statement|
13
- unless series_statement == selected_series_statement
13
+ if series_statement == selected_series_statement
14
+ series_statement.root_manifestation.update_attributes!({
15
+ :original_title => selected_series_statement.original_title,
16
+ :title_transcription => selected_series_statement.title_transcription,
17
+ :title_alternative => selected_series_statement.title_alternative
18
+ }) if series_statement.root_manifestation
19
+ else
14
20
  series_statement.manifestations.each do |manifestation|
15
21
  manifestation.series_statement = selected_series_statement
16
22
  manifestation.save!
@@ -1,3 +1,3 @@
1
1
  module EnjuResourceMerge
2
- VERSION = "0.0.15"
2
+ VERSION = "0.0.16"
3
3
  end
Binary file
@@ -9,6 +9,8 @@ two:
9
9
  id: 2
10
10
  original_title: title2
11
11
  position: 2
12
+ periodical: true
13
+ root_manifestation_id: 4
12
14
 
13
15
  three:
14
16
  id: 3
@@ -5,8 +5,11 @@ describe SeriesStatementMergeList do
5
5
 
6
6
  it "should merge series_statment" do
7
7
  series_statement_merge_list = series_statement_merge_lists(:series_statement_merge_list_00001)
8
- series_statement_merge_list.merge_series_statements(SeriesStatement.find(1)).should be_true
9
- Manifestation.find(2).series_statement.id.should eq 1
8
+ series_statement = SeriesStatement.find(2)
9
+ series_statement_merge_list.merge_series_statements(series_statement).should be_true
10
+ Manifestation.find(2).series_statement.id.should eq 2
11
+ Manifestation.find(3).series_statement.id.should eq 2
12
+ Manifestation.find(3).series_statement.original_title.should eq series_statement.original_title
10
13
  end
11
14
  end
12
15
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enju_resource_merge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-19 00:00:00.000000000 Z
12
+ date: 2012-06-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails