doc/entities.md in power_stencil-0.4.20 vs doc/entities.md in power_stencil-0.4.21
- old
+ new
@@ -848,13 +848,11 @@
```shell
$ power_stencil get custom_entity/test_entity --raw
--- !ruby/object:MyCustomEntity
:name: test_entity
-:parent: !psref
- type: :custom_entity
- name: foo
+:parent: !entity custom_entity/foo
```
Here we are referencing an entity of the same type, but of course you can reference any type of entity. Using `has_one` will enforce the type of data you reference. Let's try to mess-up:
```ruby
PowerStencil DSL> e.parent = :bar
@@ -912,15 +910,11 @@
Which translates at persistence level as:
```shell
--- !ruby/object:MyCustomEntity
:sub_properties:
-- !psref
- type: :base_entity
- name: prop1
-- !psref
- type: :base_entity
- name: prop2
+- !entity base_entity/prop1
+- !entity base_entity/prop2
:name: test_entity
```
Nice !
**:information_source: See more advanced features, like the very powerful reverse methods in the [`universe_compiler` advanced relations documentation].** [universe_compiler] is the Gem that manages entities under the hood, but it is much lower level than `PowerStencil`, so unless you are really interested in what happens under the hood, you should not really care about it. Yet you should definitely check what the `with_reverse_method` and `unique` options do to the `has_many` directive.