govuk_content_models 15.1.1 → 15.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/app/traits/taggable.rb +4 -4
- data/lib/govuk_content_models/version.rb +1 -1
- data/test/models/artefact_tag_test.rb +4 -4
- metadata +4 -4
data/CHANGELOG.md
CHANGED
data/app/traits/taggable.rb
CHANGED
@@ -63,10 +63,10 @@ module Taggable
|
|
63
63
|
|
64
64
|
Tag.validate_tag_ids(tag_ids, tag_type)
|
65
65
|
|
66
|
-
current_tags = attributes['tags'].reject {|t| t[
|
66
|
+
current_tags = attributes['tags'].reject {|t| t['tag_type'] == tag_type }
|
67
67
|
|
68
68
|
self.tags = current_tags + tag_ids.map {|tag_id|
|
69
|
-
{tag_id
|
69
|
+
{'tag_id' => tag_id, 'tag_type' => tag_type}
|
70
70
|
}
|
71
71
|
end
|
72
72
|
|
@@ -77,7 +77,7 @@ module Taggable
|
|
77
77
|
def set_primary_tag_of_type(tag_type, tag_id)
|
78
78
|
Tag.validate_tag_ids([tag_id], tag_type)
|
79
79
|
|
80
|
-
tag_tuple = {tag_id
|
80
|
+
tag_tuple = {'tag_id' => tag_id, 'tag_type' => tag_type}
|
81
81
|
|
82
82
|
current_tags = attributes['tags'].dup
|
83
83
|
current_tags.delete(tag_tuple)
|
@@ -90,7 +90,7 @@ module Taggable
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def tags=(new_tag_tuples)
|
93
|
-
self.tag_ids = new_tag_tuples.map {|tuple| tuple[
|
93
|
+
self.tag_ids = new_tag_tuples.map {|tuple| tuple['tag_id'] }
|
94
94
|
super(new_tag_tuples)
|
95
95
|
end
|
96
96
|
|
@@ -47,10 +47,10 @@ class ArtefactTagTest < ActiveSupport::TestCase
|
|
47
47
|
a.keywords = ['bacon']
|
48
48
|
|
49
49
|
expected_tags = [
|
50
|
-
{ tag_id
|
51
|
-
{ tag_id
|
52
|
-
{ tag_id
|
53
|
-
{ tag_id
|
50
|
+
{ "tag_id" => "crime", "tag_type" => "section" },
|
51
|
+
{ "tag_id" => "crime/the-police", "tag_type" => "section" },
|
52
|
+
{ "tag_id" => "businesslink", "tag_type" => "legacy_source" },
|
53
|
+
{ "tag_id" => "bacon", "tag_type" => "keyword" },
|
54
54
|
]
|
55
55
|
assert_equal ["crime", "crime/the-police", "businesslink", "bacon"], a.tag_ids
|
56
56
|
assert_equal expected_tags, a.attributes["tags"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_content_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 15.1.
|
4
|
+
version: 15.1.2
|
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: 2014-07-
|
12
|
+
date: 2014-07-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bson_ext
|
@@ -466,7 +466,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
466
466
|
version: '0'
|
467
467
|
segments:
|
468
468
|
- 0
|
469
|
-
hash: -
|
469
|
+
hash: -641385530309798652
|
470
470
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
471
471
|
none: false
|
472
472
|
requirements:
|
@@ -475,7 +475,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
475
475
|
version: '0'
|
476
476
|
segments:
|
477
477
|
- 0
|
478
|
-
hash: -
|
478
|
+
hash: -641385530309798652
|
479
479
|
requirements: []
|
480
480
|
rubyforge_project:
|
481
481
|
rubygems_version: 1.8.23
|