The record is not set correctly in the following situations.(I think this case rarely happens)
books.yml
Sample code
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'active_hash'
end
class Book < ActiveYaml::Base
end
class SubBook < Book
set_filename 'books'
end
# Book.count should be 1, and it will be 1.
puts "Book.count => #{Book.count}"
# SubBook.count should be 1, but it will be 0.
puts "SubBook.count => #{SubBook.count}"
# Set data_loaded to false
SubBook.data_loaded = false
# SubBook.count will be 1
puts "SubBook.count => #{SubBook.count}"
I think the solution to this problem is to change data_loaded from class_attributes to class instance variable. What do you think?
The record is not set correctly in the following situations.(I think this case rarely happens)
books.yml
Sample code
I think the solution to this problem is to change
data_loadedfrom class_attributes to class instance variable. What do you think?