Sha256: d6f4dae108a6b8a6de1b40a692d2034eaece6a726efb54156eb0c01c91c31cee
Contents?: true
Size: 527 Bytes
Versions: 1
Compression:
Stored size: 527 Bytes
Contents
module ActiveRecordYaml class Model extend ActiveModel::Naming def self.all items end def self.first items.first end def self.last items.last end def self.count items.length end def self.items data = File.read(data_filename) YAML.load(data).map { |x| OpenStruct.new(x) } end def self.data_filename data_dir.join("#{model_name.plural}.yml") end def self.data_dir Rails.root.join("config", "data") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_record_yaml-0.1.3 | lib/active_record_yaml/model.rb |