diff options
Diffstat (limited to 'bin/api')
| -rwxr-xr-x | bin/api | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -5,6 +5,7 @@ require 'bundler/inline' gemfile do source 'https://rubygems.org' + gem "csv", "~> 3.0" gem "declarative_policy", "~> 1.0" gem "erb", "~> 4.0" gem "globalid", "~> 1.0" @@ -30,7 +31,9 @@ $host = ENV.fetch("HOST", "localhost:#{$port}") class Entity class << self def all - @items ||= [] + @items ||= ::CSV.read(File.join(__dir__, "../db/#{self.name.downcase}s.csv"), headers: true).map do |row| + new(row.to_h.transform_keys(&:to_sym)) + end end def create!(attributes) |
