Skip to content

Commit

Permalink
Merge pull request #364 from alphagov/laurent/fix-bug
Browse files Browse the repository at this point in the history
Fix undefined method #empty? for nil:NilClass
  • Loading branch information
Laurent Curau authored Jan 22, 2018
2 parents 40454f2 + 31601f0 commit 34e7054
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/models/dataset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Dataset
:_index, :_type, :_id, :_score, :_source,
:_version

attr_reader :organisation,:docs, :datafiles
attr_reader :organisation

index_name ENV['ES_INDEX'] || "datasets-#{Rails.env}"

Expand Down Expand Up @@ -62,10 +62,18 @@ def self.datafile_formats
map_keys(buckets)
end

def docs
Array(@docs)
end

def docs=(docs)
@docs = docs.map { |file| Doc.new(file) }
end

def datafiles
Array(@datafiles)
end

def datafiles=(datafiles)
@datafiles = datafiles.map { |file| Datafile.new(file)}
end
Expand Down

0 comments on commit 34e7054

Please sign in to comment.