Module: BuiltInData::ClassMethods
- Defined in:
- lib/built_in_data.rb
Instance Method Summary collapse
-
#built_in_object_id(key) ⇒ Object
Cached database id for fixture files.
- #delete_all ⇒ Object
-
#load_built_in_data!(hash = nil) ⇒ Object
Inserts new, updates existing, and destorys removed built_in objects.
Instance Method Details
#built_in_object_id(key) ⇒ Object
Cached database id for fixture files
27 28 29 |
# File 'lib/built_in_data.rb', line 27 def built_in_object_id(key) built_in_object_ids[key] end |
#delete_all ⇒ Object
31 32 33 34 |
# File 'lib/built_in_data.rb', line 31 def delete_all @built_in_object_ids = nil super end |
#load_built_in_data!(hash = nil) ⇒ Object
Inserts new, updates existing, and destorys removed built_in objects
17 18 19 20 21 22 23 24 |
# File 'lib/built_in_data.rb', line 17 def load_built_in_data!(hash = nil) objects_hash = prepare_objects_hash(hash) destroy_removed_built_in_objects!(objects_hash.keys) objects_hash.map do |key, attributes| create_or_update!(key, attributes) end end |