-
Notifications
You must be signed in to change notification settings - Fork 190
Open
Description
The record is not set correctly in the following situations.(I think this case rarely happens)
books.yml
- id: 1
name: Book1Sample 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?
Knack
Metadata
Metadata
Assignees
Labels
No labels