Skip to content

Ability to build default associations #10

Description

@onemanstartup

I want to create default associations, however there is no methods generated for defaults for associations. If I patch FixtureBot::Default::Definition to generating methods this value is not sent to association or I can't call association inside a block in default.

I think this feature would be great, it would be a lot easier to create default associations without manually referenced it.
I asked AI, but it generated a big change so I hesitate to suggest it.

 # no method account
actor.account do |fixture|
fixture.key.to_s.delete_suffix("_actor").to_sym
end
actor.roles { |fixture| [ "owner" ] }
actor.name do |fixture|
fixture.key.to_s.split("_").first.capitalize
end
actor(:bob_personal_account_actor)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions