mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
c09a4fd23d
Allow specifying what fixtures can be ignored by setting `ignore` in fixtures YAML file: # users.yml _fixture: ignore: - base base: &base admin: false introduction: "This is a default description" admin: <<: *base admin: true visitor: <<: *base In the above example, "base" fixture will be ignored when creating users fixture. This is helpful when you want to inherit attributes and it makes your fixtures more "DRY".
33 lines
536 B
YAML
33 lines
536 B
YAML
_fixture:
|
|
ignore: DEAD_PARROT
|
|
|
|
DEAD_PARROT: &DEAD_PARROT
|
|
parrot_sti_class: DeadParrot
|
|
|
|
george:
|
|
name: "Curious George"
|
|
treasures: diamond, sapphire
|
|
parrot_sti_class: LiveParrot
|
|
|
|
louis:
|
|
name: "King Louis"
|
|
treasures: [diamond, sapphire]
|
|
parrot_sti_class: LiveParrot
|
|
|
|
frederick:
|
|
name: $LABEL
|
|
parrot_sti_class: LiveParrot
|
|
|
|
polly:
|
|
id: 4
|
|
name: $LABEL
|
|
killer: blackbeard
|
|
treasures: sapphire, ruby
|
|
<<: *DEAD_PARROT
|
|
|
|
DEFAULTS: &DEFAULTS
|
|
treasures: sapphire, ruby
|
|
parrot_sti_class: LiveParrot
|
|
|
|
davey:
|
|
*DEFAULTS
|