govuk_content_models 10.4.1 → 10.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 10.4.2
2
+
3
+ * Making Artefact.relatable_items a scope so that it can be chained.
4
+
1
5
  ## 10.4.1
2
6
 
3
7
  * Fix tag validation; tags slugs may only contain `/` if they're a child tag.
@@ -163,6 +163,11 @@ class Artefact
163
163
  validate :validate_prefixes_and_paths
164
164
  validate :format_of_new_need_ids, if: :need_ids_changed?
165
165
 
166
+ scope :relatable_items, proc {
167
+ where(:kind.ne => "completed_transaction", :state.ne => "archived")
168
+ .order_by([[:name, :asc]])
169
+ }
170
+
166
171
  def self.in_alphabetical_order
167
172
  order_by([[:name, :asc]])
168
173
  end
@@ -171,15 +176,6 @@ class Artefact
171
176
  where(slug: s).first
172
177
  end
173
178
 
174
- def self.relatable_items
175
- # Only retrieving the name field, because that's all we use in Panopticon's
176
- # helper method (the only place we use this), and it means the index can
177
- # cover the query entirely
178
- self.in_alphabetical_order
179
- .where(:kind.ne => "completed_transaction", :state.ne => "archived")
180
- .only(:name)
181
- end
182
-
183
179
  # The old-style section string identifier, of the form 'Crime:Prisons'
184
180
  def section
185
181
  return '' unless self.primary_section
@@ -1,4 +1,4 @@
1
1
  module GovukContentModels
2
2
  # Changing this causes Jenkins to tag and release the gem into the wild
3
- VERSION = "10.4.1"
3
+ VERSION = "10.4.2"
4
4
  end
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: 10.4.1
4
+ version: 10.4.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-04-24 00:00:00.000000000 Z
12
+ date: 2014-04-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bson_ext
@@ -465,7 +465,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
465
465
  version: '0'
466
466
  segments:
467
467
  - 0
468
- hash: 1806516958570881698
468
+ hash: 1886016262133551213
469
469
  required_rubygems_version: !ruby/object:Gem::Requirement
470
470
  none: false
471
471
  requirements:
@@ -474,7 +474,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
474
474
  version: '0'
475
475
  segments:
476
476
  - 0
477
- hash: 1806516958570881698
477
+ hash: 1886016262133551213
478
478
  requirements: []
479
479
  rubyforge_project:
480
480
  rubygems_version: 1.8.23